X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=assignment10.mdwn;h=3de34d87d11125eb79bd696e3a58e79920086388;hp=8f52ca20370e879efa536b7d720c5a7d21a6c6dd;hb=79d94c37205271ccfc38f29429e8912a84d53674;hpb=21c2f56ceac1e9445ee7cc8e15786e9521a40b9b
diff --git a/assignment10.mdwn b/assignment10.mdwn
index 8f52ca20..3de34d87 100644
--- a/assignment10.mdwn
+++ b/assignment10.mdwn
@@ -1,3 +1,7 @@
+Here are some additional homeworks, that will consolidate your understanding of what we've covered in the last weeks of the seminar. Those who are taking the class for credit: since we're so late to post these, and they add up to a substantial chunk of thinking, we won't require you to do them. But we will strongly encourage it. If you'd like to do them, and have us take account of your efforts when deciding on grades, let us know now when you propose to submit the work. (Up to the start of next term would be viable.)
+
+Of course, if you need help or want us to review your efforts, we'll be glad to discuss with you at any later point as well.
+
1. This problem is taken from _The Craft of Functional Programming_ by Simon Thompson, Addison-Wesley 1999 :
@@ -10,8 +14,8 @@
As Ken Shan points out, this is an instance of the algorithm
- for converting name/year citations (like 'v. Montague 1970')
- to numerals corresponding to their ('v. [24]'). Except that
+ for converting name/year citations (like 'see Montague 1970')
+ to numerals corresponding to their ('see [24]'). Except that
bibliograpic numerals don't start with zero.
Give some thought to efficiency: there are straightforward
@@ -22,7 +26,7 @@
leaf as soon as you see it?
Consider a variation in which you must replace each leaf with
- is number of occurrences in the tree. Is there any way to do
+ its number of occurrences in the tree. Is there any way to do
that with a single traversal?
You can assume that the tree is leaf-labeled (no labels on the
@@ -73,11 +77,11 @@
Now, go back to the GS&V assignment from [[assignment7]]. Does the monad you've now crafted enable you to code your implementation of that semantics more elegantly? You can begin by using a composite store of the same sort we used in the hints: a pair of an assignment function `r` and some `h` that associates pegs with entities.
- Is the `h` really essential to your solution? Or could you do everything with a store consisting of a single mapping from variables to entities? (You'd still be working with a State monad, but without the pegs.) Explain why or why not.
+ Are the pegs and the `h` really essential to your solution? Or could you do everything with a store consisting of a single mapping from variables to entities? (You'd still be working with a State monad, but without the pegs.) Explain why or why not.
4. The next two exercises were taken from _The Little Schemer_ Chapter 8.
- Suppose `lst` is a list of Scheme symbols (`'symbols 'are 'things 'written 'like 'this`; a list of them is `'(written like this)`). And that the behavior of `(remove 'sym lst)` is to remove every occurrence of `'sym` from `lst`.
+ Suppose `lst` is a list of Scheme symbols (`'symbols 'are 'things 'written 'like 'this`; a list of them is `'(written like this)`). And suppose that the behavior of `(remove 'sym lst)` is to remove every occurrence of `'sym` from `lst`.
Now we define a function `remove-co` which has the following behavior. It accepts as arguments a symbol, a list, and a handler `k` (I wonder why we named it that). `remove-co` calls `k` with two arguments: first, a list of all the symbols in `lst` that aren't equal to `'sym`, and second, a list of all the symbols in `lst` that are equal to `'sym` (the handler might want to, for example, see what the length of the latter list is).