Question 4-3

Suppose we want to define a way to represent pairs (or 2-tuples) in the lambda calculus. We can do this by defining the following function pair, which takes two arguments and generates a representation of a pair of those two values.

pair = λxyf.f x y
For example, to represent the value (2,3), we would call pair 2 3, which would give us λf.f 2 3.

Give a lambda expression for the function first that takes a pair represented as above and extracts the first item of the pair. Using your definition, I should be able to write first (pair 2 3) and get 2.

Solution

first = λp.p (λxy.x)

Back to Quiz 4