One-page version suitable for printing.
Statistics:
mean 26.000 (260.000/10) stddev 5.273 median 24.500 midrange 22.000-31.000 1 4.8 / 8 2 1.8 / 8 3 3.8 / 8 4 2.6 / 6 + 13-point bonus
Suppose we are using an applied lambda calculus which supports the infix arithmetic operators *, +, and -. Reduce the following lambda expression, showing your intermediate steps. It should reduce to a number.
Consider the following Haskell function.
pow2 0 = 1 pow2 n = 2 * pow2 (n - 1)
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.
What is the type of the following Haskell function?
For full credit, describe the type using Haskell syntax.member _ [] = False member query (x:xs) = if x == query then True else member query xs