"val" differenciation question
Hello,
This is probably a naive question. In the following simple program, there is a difference of behavior between the two val
I am using. Is that intentional ? Am I using this wrong ?
The commented version works fine whereas there is an error for the uncommented one.
module Ex1
use array.Array
use int.Int
use option.Option
val my_set: array (option int) -> int -> option int -> unit
(* val my_set (m: array (option int)) (i: int) (e: option int) : unit*)
let rec my_fact (mem: array (option int)) (n: int): int
=
match mem[n] with
| None -> let r = n * my_fact mem (n- 1) in
my_set mem n (Some r);
r
| Some n -> n
end
end