From: Jim Pryor Date: Wed, 15 Sep 2010 14:43:17 +0000 (-0400) Subject: damn tweaks3 X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=57e2bb5496f931fe92d9568de8ede942234257ea damn tweaks3 Signed-off-by: Jim Pryor --- diff --git a/damn.mdwn b/damn.mdwn index 1342254b..6dca070e 100644 --- a/damn.mdwn +++ b/damn.mdwn @@ -65,7 +65,6 @@ evaluates to the nested structure of pairs that Scheme displays as: ((the . man) . (read . (the . book))) and that we can think of as the tree: -; /----------------\ / \ @@ -154,14 +153,16 @@ Chris and others have applied the apparatus of continuations to the analysis of is Scheme's way of saying: -> bind the continuation of this very complex expression to k and evaluate the `...` +> bind the continuation of this complex expression to `k` and evaluate the `...` So now we define `damn` like this: (define damn (lambda () (call/cc (lambda (k) (print "bad") (k 'id))))) -Now when we do: +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`. + +What happens then when we evaluate: (cons (cons 'the 'man) (cons 'read @@ -169,9 +170,9 @@ Now when we do: (cons (damn) 'book)))) -we get something like this: +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`.