The following is a question I have on lambda expressions:
def combinator(y):
return (lambda x: lambda y: x(y))(lambda x:y)
Evaluate the following expression combinator(lambda x: x*10)(11)(12).
I understand that return statements return a value so perhaps, we should start by simplifying the lambda expression of the return statement:
(lambda x: lambda y: x(y))(lambda x:y) simplifies to (lambda y: (lambda x:y)(y)),
which further simplifies to (lambda y: y)
However, following the above logic would lead me to the wrong answer. The answer is 120.
I would like to ask, what is the method to deal with the above lambda expression?