open Pp;; #load "interpret.cmo";; open Interpret;; (* Pour tester: ocaml fib.ml Calcule fib 23 et affiche le résultat à l'écran. *) let fib = let fib = { arguments = ["n", Integer]; result = Some Integer; local_vars = []; body = If (Bin (Le, Get "n", Int 1), Set ("fib", Int 1), Set ("fib", (Bin (Plus, Function_call ("fib", [Bin (Minus, Get "n", Int 1)]), Function_call ("fib", [Bin (Minus, Get "n", Int 2)])) ))) } in { global_vars = []; definitions = ["fib", fib]; main = Writeln_int (Function_call ("fib", [Int 23])); } ;; eval fib;;