Last active
October 7, 2018 19:46
-
-
Save dbrattli/1f48ad6d4fb3ae0bcea6fb7f764344c5 to your computer and use it in GitHub Desktop.
Times 10 Curried Continuation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Return a function that takes a callback that takes the result. | |
let times10 (x: int) : ((int -> unit) -> unit) = | |
let thenDo (cb : int -> unit) = | |
cb (x * 10) | |
thenDo | |
let cb result = | |
printfn "%A" result | |
let thenDo = times10 42 | |
do thenDo(cb) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment