X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=exercises%2Fassignment3.mdwn;h=7121faee69e9b388627e33f971b4f0d2b8ee299d;hp=57b6d4d82e668da5ebe1f4889cbdae910adbfc23;hb=a68ef218fe101b9d4e7aec684d93bc8391b971a9;hpb=57be0c4918eef2e0441645bb32464bedc94c6477 diff --git a/exercises/assignment3.mdwn b/exercises/assignment3.mdwn index 57b6d4d8..7121faee 100644 --- a/exercises/assignment3.mdwn +++ b/exercises/assignment3.mdwn @@ -1,5 +1,3 @@ -** *Work In Progress* ** - ## Lists and List Comprehensions 1. In Kapulet, what does `[ [x, 2*x] | x from [1, 2, 3] ]` evaluate to? @@ -18,6 +16,7 @@ 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. + (The function you're trying to define here is like `eqlist?` in Chapter 5 of *The Little Schemer*, though you are only concerned with lists of numbers, whereas the function from *The Little Schemer* also works on lists containing symbolic atoms --- and in the final version from that Chapter, also on lists that contain other, embedded lists.) ## Numbers @@ -78,6 +77,11 @@ Using the mapping specified in this week's notes, translate the following lambda 25. For each of the above translations, how many `I`s are there? Give a rule for describing what each `I` corresponds to in the original lambda term. + This generalization depends on you omitting the translation rule: + + 6. @a(Xa) = X if a is not in X + + Evaluation strategies in Combinatory Logic ------------------------------------------