def plus(y): return lambda x: x+y, how are both arguments passed to this function?
It doesn’t — or at least,
plus() doesn’t pass both arguments into the lambda function.
lambda x: x + 3 — a function that takes in one argument and increments its argument by 3. This process is known as currying.
To address your example,
lambda x: x + 1.
three(lambda x: x + 1).
three()calls the lambda function passed in with an argument of 3 and returns the resulting value. This gives a final result of 4.
CLICK HERE to find out more related problems solutions.