projects
/
lambda.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
notes for week 4
[lambda.git]
/
assignment3.mdwn
diff --git
a/assignment3.mdwn
b/assignment3.mdwn
index
4e3c4f3
..
f93afd6
100644
(file)
--- 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.
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:
Recall that version 1 style lists are constructed like this:
@@
-46,7
+46,7
@@
eq 3 3
Then `length mylist` evaluates to 3.
Then `length mylist` evaluates to 3.
-1. What does `head (tail (tail mylist))` evaluate to?
+1. W
arm-up: W
hat 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!,
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
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).
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:
[The following should be correct, but won't run in my browser: