1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-12 14:28:08 +03:00
juvix/tests/benchmark/cps/ocaml/cps.ml
2022-11-03 09:38:09 +01:00

17 lines
261 B
OCaml

(* compute the Nth Fibonacci number modulo 2^28 with CPS *)
let step k n m cont =
if k == 0 then
n
else
cont (k - 1) m ((n + m) mod 268435456)
let rec go k n m = step k n m go
let fib k = go k 0 1
;;
print_int (fib 100000000);
print_newline ()