add map2 extra credit
authorjim <jim@web>
Sat, 14 Feb 2015 17:41:45 +0000 (12:41 -0500)
committerLinux User <ikiwiki@localhost.members.linode.com>
Sat, 14 Feb 2015 17:41:45 +0000 (12:41 -0500)
exercises/assignment3.mdwn

index b76e38c..a6d3173 100644 (file)
@@ -18,6 +18,9 @@
 
 8. Suppose you have two lists of integers, `left` and `right`. You want to determine whether those lists are equal, that is, whether they have all the same members in the same order. How would you implement such a list comparison? You can write it in Scheme or Kapulet using `letrec`, or if you want more of a challenge, in the Lambda Calculus using your preferred encoding for lists. If you write it in Scheme, don't rely on applying the built-in comparison operator `equal?` to the lists themselves. (Nor on the operator `eqv?`, which might not do what you expect.) You can however rely on the comparison operator `=` which accepts only number arguments. If you write it in the Lambda Calculus, you can use your implementation of `leq`, requested below, to write an equality operator for Church-encoded numbers. [[Here is a hint|assignment3 hint3]], if you need it.
 
+(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 the strategy discussed this week for defining `tail`. Purely extra credit.)
+
+
 
 ## Numbers