I have a question about OCaml:Assume the following function declarations:
let secret x y = let secret' x y z = x + y - z in let z = if x mod 2 = 0 then y else x - y in secret' x z ;;
print_int (secret 3 2 (-5));;
The output will be 9.
Why is the result 9?
Is this the way its calculations are performed?
let secret 3 2 = let secret' 3 2 z = 3 + 2 - z in let z = if 3 mod 2 = 0 then 2 else 3 - 2 in secret' 3 1
Why doesn't it stop at secret' 3 1 but instead comes up with the result 9? Computes it secret' 3 1 (-5) = 3 + 1 -(-5) ? Why?