damn tweaks14
[lambda.git] / damn.mdwn
index 8bbe724..cd01134 100644 (file)
--- a/damn.mdwn
+++ b/damn.mdwn
@@ -126,7 +126,7 @@ Now we can say:
 
 and we get back:
 
-       ((the . man) . (read . (the . (id . book))))
+       '((the . man) . (read . (the . (id . book))))
 
 ---or an equivalent shorthand. (I'm now going to stop saying this.)
 
@@ -149,7 +149,7 @@ But then:
 
 gives us:
 
-       ((the . man) . (read . (the . (bad . book))))
+       '((the . man) . (read . (the . (bad . book))))
 
 Which is not quite what we're looking for. We don't want to contribute the normal adjectival meaning of "bad" to the proposition asserted. Instead we want badness to be a side-issue linguistic contribution. We might try:
 
@@ -157,9 +157,9 @@ Which is not quite what we're looking for. We don't want to contribute the norma
 
 But then we'd get:
 
-       ((the . man) . (read . (the . ((side-effect . bad) . book))))
+       '((the . man) . (read . (the . ((side-effect . bad) . book))))
 
-and we said at the outset that the context `(the . ( ... . book))` shouldn't need to know how to interact with affective meanings. That's precisely the problem we're trying to solve.
+and we said at the outset that the context `(the . (<> . book))` shouldn't need to know how to interact with affective meanings. (I'll use `<>` to indicate a "hole" in a larger expression.)
 
 
 Let's use continuations
@@ -167,7 +167,7 @@ Let's use continuations
 
 A promising way to handle this is with **continuations**, which you will get much more familiar with as this seminar progresses. Don't worry about not understanding what's going on quite yet. This is just an advertisement that's supposed to provoke your imagination.
 
-Chris and others have applied the apparatus of continuations to the analysis of expressives in the paper cited at the top. For a simple in-class demonstration, we tried to do the following.
+Chris and others have applied the apparatus of continuations to the analysis of expressives in the paper cited at the top. For a simple in-class demonstration, here's what we tried to do.
 
        (call/cc (lambda (k) ...))
 
@@ -193,14 +193,14 @@ What happens then when we evaluate:
 We get something like this:
 
 <blockquote>
-<strong>"bad"</strong> ((the . man) . (read . (the . (id . book))))
+<strong>"bad"</strong> '((the . man) . (read . (the . (id . book))))
 </blockquote>
 
-Yay! The affective meaning has jumped out of the compositional evaluation of the main sentence, and the context `(the . (... . book))` only has to deal with the trivial adjectival meaning `'id`.
+Yay! The affective meaning has jumped out of the compositional evaluation of the main sentence, and the context `(the . (<> . book))` only has to deal with the trivial adjectival meaning `'id`.
 
 
-But
----
+But...
+------
 
 As came out in discussion, the `print` we're using here already constitutes a kind of side-effect mechanism of its own. If you say:
 
@@ -208,15 +208,17 @@ As came out in discussion, the `print` we're using here already constitutes a ki
 
 and then ask for the evaluation of:
 
-       (+ 2 (three-thunk))
+       (+ (+ 2 (three-thunk)) 1)
 
 you'll see something like:
 
 <blockquote>
-<strong>"hi"</strong> 5
+<strong>"hi"</strong> 6
 </blockquote>
 
-So the demonstration we tried in class was pedagogically flawed. It didn't properly display how continuations are a minimally effective apparatus for representing affective meaning. In fact, continuations were still doing the work, but it wasn't the explicit continuations we were writing out for you. It was instead continuations implicit in the `print` operation.
+In other words, the printing of "hi" already happens on the side, outside of the main evaluation. Continuations don't need to be explicitly invoked.
+
+So the demonstration we tried in class was pedagogically flawed. It didn't properly display how continuations are a minimally effective apparatus for representing affective meaning. In fact, continuations *were* still doing the work, but it wasn't the explicit continuations we were writing out for you. It was instead continuations implicit in the `print` operation.
 
 So a better demonstration would do without any device like `print` that already incorporates continuations implicitly. Any continuation-manipulation should be fully explicit.
 
@@ -226,7 +228,7 @@ Can we do better?
 
 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)))))
+       '((side-effect . bad) . ((the . man) . (read . (the . (id . book)))))
 
 Only we want to get this from the evaluation of:
 
@@ -246,9 +248,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, at-issue tree is all built, then we return a pair `((side-effect bad) AT-ISSUE-TREE)`.
+The idea here is we capture the continuation that `(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 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) ...)`.
+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 application of `(cons (cons 'side-effect 'bad) <>)` to anything.
 
 
 With undelimited continuations
@@ -268,7 +270,7 @@ but the behavior is the same. It's just that now our continuation doesn't stretc
 
        (reset ...)
 
-This is a kind of continuation-scope-marker. There are some interesting default behaviors if you don't explicitly specify where the limits are. But we'll be fully explicit here.
+This is a kind of continuation-scope-marker. There are some interesting default behaviors if you don't explicitly specify where the limits are. In fact, in the interactive interpreter we wouldn't need to ever explicitly mark the scopes. They'd by default be just where we want them to be. But we'll be fully explicit here.
 
 If a block `...` never invokes a shift, then `(reset ...)` will evaluate just the same as `...`. So for uniformity, we can designate our continuation-scopes even on computations that don't capture and manipulate continuations.
 
@@ -284,11 +286,11 @@ We evaluate:
                                          (cons (damn) 
                                                'book)))))
 
-Remember, the reset isn't actually *doing* anything. It's not a function that's taking the other material as an argument. It's instead a scope-marker. Here it's not even needed (and in fact in the interactive interpreter, it wouldn't even be needed when we invoke continuations, because of the default position it takes).  But we're inserting it to be explicit and uniform.
+Remember, the reset isn't actually *doing* anything. It's not a function that's taking the other material as an argument. It's instead a scope-marker. Here it's not even needed; but we're inserting it anyway to be explicit and uniform.
 
 Evaluating that gives us:
 
-       ((the . man) . (read . (the . (id . book))))
+       '((the . man) . (read . (the . (id . book))))
 
 
 Now to pair that with an affective side-issue content, we'd instead define `damn` as:
@@ -306,7 +308,7 @@ And voila:
 
 evaluates to:
 
-       ((side-effect bad) ((the . man) . (read . (the . (id . book)))))
+       '((side-effect bad) ((the . man) . (read . (the . (id . book)))))
 
 So that's the straightforward way of repairing the strategy we used in class, without using `print`. We also have to switch to using delimited continuations.
 
@@ -380,7 +382,7 @@ We won't do much to explain this. We'll just leave it for you to chew on.
        (list "main content" 'i (list 'like (list 'the (damn1) 'boy)))
        ; '("main content" i (like (the (("side effect" bad) . id) boy)))
 
-; However, the context (list 'the ... 'boy) is now being asked to operate
+; However, the context (list 'the <> 'boy) is now being asked to operate
 ; on an element (("side effect" bad) . id), and it may complain it doesn't
 ; know what that is. It knows how to use 'id to get (list 'the 'id 'boy),
 ; and how to use 'bad to get (list 'the 'bad 'boy), but we're supposed to