RosettaCodeData/Task/Man-or-boy-test/OCaml/man-or-boy-test.ocaml
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

13 lines
278 B
Text

let rec a k x1 x2 x3 x4 x5 =
if k <= 0 then
x4 () + x5 ()
else
let m = ref k in
let rec b () =
decr m;
a !m b x1 x2 x3 x4
in
b ()
let () =
Printf.printf "%d\n" (a 10 (fun () -> 1) (fun () -> -1) (fun () -> -1) (fun () -> 1) (fun () -> 0))