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.
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:
((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:
We get something like this:
-> <bold>"bad"</bad> ((the . man) . (read . (the . (id . book))))
+<blockquote>
+<bold>"bad"</bad> ((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`.
you'll see something like:
- <bold>"hi"</bad> 5
+<blockquote>
+<bold>"hi"</bad> 5
+</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.
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.