From: Jim Pryor Date: Thu, 16 Dec 2010 14:04:06 +0000 (-0500) Subject: assignment 10 tweaks X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=e98de4be4fb298c4d0cc27b5c2956c880d3649a5 assignment 10 tweaks Signed-off-by: Jim Pryor --- diff --git a/assignment10.mdwn b/assignment10.mdwn index a2e5d42f..c8ff72c6 100644 --- a/assignment10.mdwn +++ b/assignment10.mdwn @@ -60,7 +60,7 @@ Is the `h` really essential to your solution? Or could you do everything with a 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`. - 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 sumbols 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). + 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). Here is a partial implementation. You should fill in the blanks. If you get stuck, you can consult the walkthough in _The Little Schemer_, or talk to us. @@ -93,7 +93,7 @@ Is the `h` really essential to your solution? Or could you do everything with a (insert-co new before after (cdr lst) (lambda (new-lst lefts rights) ________)))))) -6. Go back to the "abSd" problem we presented in [[From List Zippers to Continuations]]. Consider the "tc" solution which uses explicitly passed continuations. Try to reimplement this using reset and shift instead of having an explicit `k` argument. This will likely be challenging but rewarding. The notes on [[CPS and Contunuation Operators]], especially the examples at the end, should be helpful. We are of course also glad to help you out. +6. Go back to the "abSd" problem we presented in [[From List Zippers to Continuations]]. Consider the "tc" solution which uses explicitly passed continuations. Try to reimplement this using reset and shift instead of having an explicit `k` argument. This will likely be challenging but rewarding. The notes on [[CPS and Continuation Operators]], especially the examples at the end, should be helpful. We are of course also glad to help you out. 7. Can you reimplement your solution to [[assignment9]] using reset and shift?