The eval command
eval <expr> evaluates a closed IML expression and reports its value. It is the
quickest way to sanity-check that a function computes what you expect while
building up IML code — the equivalent of typing an expression at a REPL.
let rec fib (n:int) : int =
if n <= 1 then n else fib (n-1) + fib (n-2)
eval fib 10 (* 55 *)
eval List.rev [1;2;3] (* [3;2;1] *)
eval (1, true, [4;5]) (* (1, true, [4;5]) *)
eval "hello" ^ " world" (* "hello world" *)evaltakes an expression, not a binding (unlikelet)- CodeLogician CLI's
checksubcommand reports one result pereval, in source order, undereval_result_1,eval_result_2, ... with the value in thevalue_as_ocamlfield.- Note that
eval <expr>as a syntaxic structure has no direct relation with "eval" incodelogician eval ....
- Note that