damn tweaks13
[lambda.git] / damn.mdwn
index 5947632..b0b2d61 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,9 +167,9 @@ 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 ...))
+       (call/cc (lambda (k) ...))
 
 is Scheme's way of saying:
        
@@ -180,7 +180,7 @@ So now we define `damn` like this:
 
        (define damn (lambda () (call/cc (lambda (k) (print "bad") (k 'id)))))
 
-In other words, `damn` is a thunk. When that thunk is evaluated (`(damn)`), we capture the pending future of the computation and bind that to `k`. Then we print "bad" and supply the argument `'id` to `k`. This last step means we go on evaluating the pending future contribution as if `(damn)` had simply returned `'id`.
+In other words, `damn` is a thunk. When that thunk is applied---we evaluate `(damn)`---we capture the pending future of that application and bind that to `k`. Then we print "bad" and supply the argument `'id` to `k`. This last step means we go on evaluating the pending future as if `(damn)` had simply returned `'id`.
 
 What happens then when we evaluate:
 
@@ -193,10 +193,10 @@ What happens then when we evaluate:
 We get something like this:
 
 <blockquote>
-<bold>"bad"</bad> ((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
@@ -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>
-<bold>"hi"</bad> 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:
 
@@ -248,7 +250,7 @@ It's not immediately clear how to do it with "undelimited" continuations, of the
 
 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 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
@@ -258,7 +260,7 @@ The straightforward way to fix this is to use, not undelimited continuations, bu
 
 A delimited continuation is captured not by using `call/cc`, but instead by using a variety of other operators. We'll use the operator `shift`. This substitutes for `call/cc`. The syntax in Scheme is slightly different. Whereas we wrote:
 
-       (call/cc (lambda k ...))
+       (call/cc (lambda (k) ...))
 
 we instead write:
 
@@ -288,7 +290,7 @@ Remember, the reset isn't actually *doing* anything. It's not a function that's
 
 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