From ad43a06215221befc3e67b650dfcf43f0921ef00 Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Wed, 15 Sep 2010 10:57:07 -0400 Subject: [PATCH] damn tweaks4 Signed-off-by: Jim Pryor --- damn.mdwn | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/damn.mdwn b/damn.mdwn index 6dca070e..32a0a3b0 100644 --- a/damn.mdwn +++ b/damn.mdwn @@ -30,18 +30,27 @@ We start with a simulation of semantic composition: That evaluates to nested structure of pairs, that Scheme displays as: - ((the . man) . (read . (the . book))) + '((the . man) . (read . (the . book))) + +If you try it yourself, you may see instead: + + '((the . man) read the . book) + +This is shorthand for the same thing. Just trust me on that. + +What's going on here? `(cons M N)` is a request to build an ordered pair out of the values M and N. -Scheme displays that pair as `(M . N)` You can't write the pair that way yourself: -if you tried to, Scheme would think you're trying to apply the function M to some arguments, which you're not, and also +Scheme displays that pair as `'(M . N)` You can't write `(M . N)` yourself and expect Scheme to understand that you're talking about this pair. If you tried, to, Scheme would think you're trying to apply the function M to some arguments, which you're not, and also Scheme would be confused by what argument the `.` is supposed to be. So, you say: (cons M N) and that evaluates to an ordered pair, and Scheme displays that ordered pair as - (M . N) + '(M . N) + +You *can* write `'(M . N)` (with the prefixed single quote), and Scheme will understand you then. However, we're going to be using that same single quote prefix to do something else in a moment, and I don't want now to explain how these uses are related. So we'll write out `(cons M N)` longhand, and we'll leave the `'(M . N)` notation to Scheme for displaying the pair we built. There is an underlying reason why parentheses are used both when displaying the ordered pair, and also to mean "apply this function to these arguments." However, at this point, you may well see this as a confusing overloading of parentheses to fill different syntactic roles. @@ -62,7 +71,7 @@ The program we submitted to Scheme: evaluates to the nested structure of pairs that Scheme displays as: - ((the . man) . (read . (the . book))) + '((the . man) . (read . (the . book))) and that we can think of as the tree: @@ -116,6 +125,11 @@ and we get back: ((the . man) . (read . (the . (id . book)))) +If you try this yourself, you may see instead: + + '((the . man) read the id . book) + + Now we want to get some affective meaning into damn. So we might try: @@ -172,7 +186,9 @@ What happens then when we evaluate: We get something like this: -> "bad" ((the . man) . (read . (the . (id . book)))) +
+"bad" ((the . man) . (read . (the . (id . book)))) +
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`. @@ -186,7 +202,9 @@ and then ask for the evaluation of: you'll see something like: - "hi" 5 +
+"hi" 5 +
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. @@ -262,8 +280,15 @@ Now to pair that with an affective side-issue content, we'd instead define `damn And voila: - ((side-effect bad) ((the . man) . (read . (the . (id . book))))) +(reset (cons (cons 'the 'man) + (cons 'read + (cons 'the + (cons (damn) + 'book))))) +evaluates to: + + ((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. -- 2.11.0