I'm trying to implement the Y-combinator like in the definition by Curry.
This code does not work. It causes infinite recursion.
F = (lambda f: (lambda x: (1 if x == 0 else (x * (f(x-1))))))
Y = (
lambda f:
(lambda x: f(x(x)))
(lambda x: f(x(x)))
)
Y(F)(3)
However, this one does work:
Y = (
lambda f:
(lambda x: f(
lambda v: x(x)(v)
))
(lambda x: f(
lambda v: x(x)(v)
))
)
Y(F)(3)
Why is the first one not working, but the second one is?