X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=exercises%2Fassignment3.mdwn;h=f80fe71c355912c10431fde30ba34c20571ac691;hp=b76e38cd13c5fa6cda7750aa99b13f909c757c72;hb=588916b85952d356b51cccea0fb38b8cc1582174;hpb=718e30fba02b10ced1bdd08c751cf83e28009846 diff --git a/exercises/assignment3.mdwn b/exercises/assignment3.mdwn index b76e38cd..f80fe71c 100644 --- a/exercises/assignment3.mdwn +++ b/exercises/assignment3.mdwn @@ -25,6 +25,10 @@ 10. In last week's homework, you gave a Lambda Calculus definition of `succ` for Church-encoded numbers. Can you now define `pred`? Let `pred 0` result in whatever `err` is bound to. This is challenging. For some time theorists weren't sure it could be done. (Here is [some interesting commentary](http://okmij.org/ftp/Computation/lambda-calc.html#predecessor).) However, in this week's notes we examined one strategy for defining `tail` for our chosen encodings of lists, and given the similarities we explained between lists and numbers, perhaps that will give you some guidance in defining `pred` for numbers. + (Want a further challenge? Define `map2` in the Lambda Calculus, using our right-fold encoding for lists, where `map2 g [a, b, c] [d, e, f]` should evaluate to `[g a d, g b e, g c f]`. Doing this will require drawing on a number of different tools we've developed, including that same strategy for defining `tail`. Purely extra credit.) + + + 11. Define `leq` for numbers (that is, ≤) in the Lambda Calculus. Here is the expected behavior, where `one` abbreviates `succ zero`, and `two` abbreviates `succ (succ zero)`.