In lambda calculus, a function denoted by λ takes exactly one argument and returns exactly one output. With this in mind, write the λ-calculus expression of a function that takes two arguments and returns the second.
Explain briefly (no more than 3-4 sentences) how your expression is doing what is being asked to do. [Hint: think about this function in terms of Currying.]
The λ-calculus expression of a function that takes two arguments and returns the second is written below:
λx.λy.y
So, this expression takes two arguments, x and y, one at a time and returns the second argument,i.e., y.
Since, lambda exp takes only one argument at a time, so through currying we can break a lambda function having multiple arguments into a series of functions in such a way that output of one function will be provided as input to another function.
So, in this expression, we are first passing x which is not returning anything and then we are passing and the function will return y.
Get Answers For Free
Most questions answered within 1 hours.