Y - Combinator
I've been trying to learn about Y - Combinators (an explanation on that would be lovely as well) and came across an example from this wiki. An in depth explanation on the subject would be much appreciated in either Haskell or Python. Pleaaase!
Code
fix :: (a -> a) -> a
fix f = f (fix f)
Problem
The function calledfix
returns 9
when fix
is applied to (\x -> 9)
and I have no clue why; when I follow the stack I visualize f(f ... (fix f) ...)
.
>> fix (\x -> 9)
>> 9