Skip to content

Instantly share code, notes, and snippets.

@Leonidas-from-XIV
Created November 9, 2017 19:11
Show Gist options
  • Save Leonidas-from-XIV/370144f05cb9020fa0aff7de93085359 to your computer and use it in GitHub Desktop.
Save Leonidas-from-XIV/370144f05cb9020fa0aff7de93085359 to your computer and use it in GitHub Desktop.
Peano arithmetics in Continuation Passing Style
let const v k =
k v
let inc k v =
k (v + 1)
let print v =
Printf.printf "Value %d\n" v
let () =
const 0 @@ print
let () =
const 0 @@ inc @@ inc @@ inc @@ inc @@ print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment