When you write let x x = ..., you define a function with a name xthat associates the name xwith its argument.
Since you used letinstead let rec, the function does not know its name, as far as you know, the only thing xworth knowing is the one that is passed as an argument.
Therefore, when you call a function with x 2, it associates a value 2with a name xand evaluates x+1, receiving 3as a result.
source
share