I copied a recursive list matching function from a slide of an introductory ocaml course.
let rec fac n = match n with 0 -> 1 | _ -> n * fac(n-1);; fac 3;;
I get: "Error: Unbound value fac"
Why is this?
Using M-X tuareg-eval-buffer in emacs gives:
OCaml version 4.02.3 # let rec fac n = match n with 0 -> 1 | _ -> n * fac(n-1);; fac 3;; val fac : int -> int = <fun> # - : int = 6 #
You probably run M-X tuarge-eval-region with only the fac 3 selected so the function was never defined.
fac 3
Using M-X tuareg-eval-buffer in emacs gives:
You probably run M-X tuarge-eval-region with only the
fac 3
selected so the function was never defined.