Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //9.7.2
- //recursive
- let rec fib = function
- |0 -> 0
- |1 -> 1
- |n -> fib (n-1) + fib (n-2)
- //Continuation
- let rec fibC n c =
- match n with
- |0 -> c 0
- |1 -> c 1
- |n -> fibC (n-1) (fun res1 -> fibC (n-2) (fun res2 -> c(res2+res1)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement