From 88225f0c3bfc7b9008add2fcb7db466c9c04336d Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Wed, 15 Sep 2010 10:59:50 -0400 Subject: [PATCH] damn tweaks5 Signed-off-by: Jim Pryor --- damn.mdwn | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/damn.mdwn b/damn.mdwn index 32a0a3b0..2738ec18 100644 --- a/damn.mdwn +++ b/damn.mdwn @@ -210,7 +210,7 @@ So the demonstration we tried in class was pedagogically flawed. It didn't prope So a better demonstration would do without any device like `print` that already incorporates continuations implicitly. Any continuation-manipulation should be fully explicit. -Instead of representing the side-issue affective contribution by printing "bad", let's instead try to build a pair of side-effect contributions and main-issue assertion. Then what we want would be something like: +Instead of representing the side-issue affective contribution by printing "bad", let's instead try to build a pair of side-effect contributions and at-issue assertion. Then what we want would be something like: ((side-effect . bad) . ((the . man) . (read . (the . (id . book))))) @@ -232,9 +232,9 @@ It's not immediately clear how to do it with "undelimited" continuations, of the (define damn (lambda () (call/cc (lambda (k) (cons (cons 'side-effect 'bad) (k 'id)))))) -The idea here is we capture the continuation that the thunk `(damn)` has when it gets evaluated. This continuation is bound to the variable `k`. We supply `'id` as an argument to that continuation. When the main-issues tree is all built, then we return a pair `((side-effect bad) MAIN-ISSUE-TREE)`. +The idea here is we capture the continuation that the thunk `(damn)` has when it gets evaluated. This continuation is bound to the variable `k`. We supply `'id` as an argument to that continuation. When the main, at-issue tree is all built, then we return a pair `((side-effect bad) AT-ISSUE-TREE)`. -However, this doesn't work. The reason is that an undelimited continuation represents the future of the evaluation of `(damn)` *until the end of the computation*. So when `'id` is supplied to `k`, we go back to building the main-issue tree until we're finished *and that's the end of the computation*. We never get to go back and evaluate the context `(cons (cons 'side-effect 'bad) ...)`. +However, this doesn't work. The reason is that an undelimited continuation represents the future of the evaluation of `(damn)` *until the end of the computation*. So when `'id` is supplied to `k`, we go back to building the at-issue tree until we're finished *and that's the end of the computation*. We never get to go back and evaluate the context `(cons (cons 'side-effect 'bad) ...)`. The straightforward way to fix this is to use, not undelimited continuations, but instead a more powerful apparatus called "delimited continuations." These too will be explained in due course, don't expect to understand all this now. @@ -354,7 +354,7 @@ We won't do much to explain this. We'll just leave it for you to chew on. ; '("main content" i (like (the id boy))) -; If we use damn1, we've added in the affective side-effect: +; If we use damn1, we've added in the affective side effect: (list "main content" 'i (list 'like (list 'the (damn1) 'boy))) ; '("main content" i (like (the (("side effect" bad) . id) boy))) @@ -386,7 +386,7 @@ We won't do much to explain this. We'll just leave it for you to chew on. ; Instead of using reset/shift you could use an element like "print" in -; building the side-effect, as we did in class. Here you wouldn't require an +; building the side effect, as we did in class. Here you wouldn't require an ; explicit continuation, but as Chris said, that's because "print" already ; represents an implicit continuation. -- 2.11.0