I know that let rec
is used when I want recursive
.
For example,
let rec power i x = if i = 0 then 1.0 else x *. (power (i-1) x);;
Ok, I understand that.
But how about this one:
let x y = y + y in x 2
?
Should I use rec
inside?
I think I should, because it has x 2
inside, loading itself, but it seems it is fine with compiler.
So when I should use let rec
and shouldn't?
Also, what is the difference between
let (-) x y = y - x in 1-2-3;;
and
let rec (-) x y = y - x in 1-2-3;;
Are they both legal?