X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=assignment2.mdwn;h=b8a2444caef15b094dd5b67c9d6881e26030f60f;hp=04c3a282de2d35b47efc56d066d6a1291a49acc8;hb=1123b395aebb6b5392b3582bd0e310a8a4e32ff5;hpb=f6ffcb0a876f3e27d478217390ff2874c6b12dfb diff --git a/assignment2.mdwn b/assignment2.mdwn index 04c3a282..b8a2444c 100644 --- a/assignment2.mdwn +++ b/assignment2.mdwn @@ -1,3 +1,39 @@ +More Lambda Practice +-------------------- + +Insert all the implicit `( )`s and λs into the following abbreviated expressions: + +1. `x x (x x x) x` +2. `v w (\x y. v x)` +3. `(\x y. x) u v` +4. `w (\x y z. x z (y z)) u v` + +Mark all occurrences of `x y` in the following terms: + +
    +
  1. `(\x y. x y) x y` +
  2. `(\x y. x y) (x y)` +
  3. `\x y. x y (x y)` +
+ +Reduce to beta-normal forms: + +
    +
  1. `(\x. x (\y. y x)) (v w)` +
  2. `(\x. x (\x. y x)) (v w)` +
  3. `(\x. x (\y. y x)) (v x)` +
  4. `(\x. x (\y. y x)) (v y)` + +
  5. `(\x y. x y y) u v` +
  6. `(\x y. y x) (u v) z w` +
  7. `(\x y. x) (\u u)` +
  8. `(\x y z. x z (y z)) (\u v. u)` +
+ + +Lists and Numbers +----------------- + We'll assume the "Version 3" implementation of lists and numbers throughout. So:
zero ≡ \s z. z
@@ -40,6 +76,8 @@ For these exercises, assume that `LIST` is the result of evaluating:
 
 		LIST make-list empty
 
+[[Assignment 2 hint 1]]
+
 2.	Based on your answer to question 1, how might you implement the **map** function? Expected behavior:
 
 	
map f LIST <~~> (make-list (f a) (make-list (f b) (make-list (f c) (make-list (f d) (make-list (f e) empty)))))