I have hello.ml that has a length function:
let rec length l =
match l with
[] -> 0
| h::t -> 1 + length t ;;
call.ml that uses the function:
#use "hello.ml" ;;
print_int (length [1;2;4;5;6;7]) ;;
In interpreter mode (ocaml), I can use ocaml call.ml
to get the results, but when I tried to compile it with ocamlc or ocamlbuild, I got compilation error.
File "call.ml", line 1, characters 0-1:
Error: Syntax error
Then, how to modify the caller, callee, and build command to compile the code into executables?