From: jim Date: Sun, 15 Feb 2015 16:55:59 +0000 (-0500) Subject: Kyle pointed out we had them define head in terms of Kapulet/fold_right last week X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=9e15f69e42cadaeb38e649ca13a121a7576c0e4d Kyle pointed out we had them define head in terms of Kapulet/fold_right last week --- diff --git a/exercises/assignment3.mdwn b/exercises/assignment3.mdwn index f80fe71c..b7371309 100644 --- a/exercises/assignment3.mdwn +++ b/exercises/assignment3.mdwn @@ -8,7 +8,7 @@ 3. Using either Kapulet's or Haskell's list comprehension syntax, write an expression that transforms `[3, 1, 0, 2]` into `[3, 3, 3, 1, 2, 2]`. [[Here is a hint|assignment3 hint1]], if you need it. -4. Last week you defined `head` in the Lambda Calculus, using our proposed encoding for lists. Now define `empty?` (It should require only small modifications to your solution for `head`.) +4. Last week you defined `head` in terms of `fold_right`. Your solution should be straightforwardly translatable into one that uses our proposed right-fold encoding of lists in the Lambda Calculus. Now define `empty?` (It should require only small modifications to your solution for `head`.) 5. If we encode lists in terms of their *left*-folds, instead, `[a, b, c]` would be encoded as `\f z. f (f (f z a) b) c`. The empty list `[]` would still be encoded as `\f z. z`. What should `cons` be, for this encoding?