Created
November 7, 2017 09:57
-
-
Save b-studios/a313610f05db169e146104e197e5802e to your computer and use it in GitHub Desktop.
Challenge to compile using iterated CPS
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
effect exc { | |
raise(n: int): a; | |
} | |
val inc = handler { | |
raise(n) -> raise(n + 1) | |
} | |
val get = handler { | |
raise(n) -> n | |
} | |
fun f(n) { | |
if (n <= 0) { | |
raise(n) | |
} else { | |
inc({ f(n - 1) }) | |
} | |
} | |
// run with | |
get({ f(10) }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment