From 6495d054c734d27c17123d04d84f3b3cf798b743 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Sat, 2 Oct 2010 15:15:18 -0400 Subject: [PATCH 1/1] notes for week 4 --- assignment3.mdwn | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/assignment3.mdwn b/assignment3.mdwn index 4e3c4f33..f93afd61 100644 --- a/assignment3.mdwn +++ b/assignment3.mdwn @@ -4,7 +4,7 @@ Assignment 3 Once again, the lambda evaluator will make working through this assignment much faster and more secure. -*Writing recursive functions on version 1 style lists* +##Writing recursive functions on version 1 style lists## Recall that version 1 style lists are constructed like this: @@ -46,7 +46,7 @@ eq 3 3 Then `length mylist` evaluates to 3. -1. What does `head (tail (tail mylist))` evaluate to? +1. Warm-up: What does `head (tail (tail mylist))` evaluate to? 2. Using the `length` function as a model, and using the predecessor function, write a function that computes factorials. (Recall that n!, @@ -65,9 +65,17 @@ same length. That is, listLenEq mylist (makeList meh (makeList meh nil))) ~~> false - 4. Now write the same function, but don't use the length function (hint: use `leq` as a model). +##Trees## + +Since we'll be working with linguistic objects, let's approximate +trees as follows: a tree is a version 1 list +a Church number is a tree, and +if A and B are trees, then (make-pair A B) is a tree. + + + [The following should be correct, but won't run in my browser: -- 2.11.0