[racket] A primitive more fundamental than a continuation?

From: Galler (lzgaller at optonline.net)
Date: Sat Dec 1 19:28:07 EST 2012

I've been thinking about a reified continuation:

The documentation (See Guide s10.3) says "A continuation is a value that
encapsulates a piece of an expression context"

I'm coming to the belief that the continuation is actually  "an ordered
collection of computation-branches, with facilities provided to manipulate
one member of the collection"

For example:

(+ (+ 1 2) (let/cc k 3) (+ 2 3))

which yields 11

If we were to capture  k in a module level variable *k*, we can substitute 4
for the result of the third ordinal branch (counting from the left)

(*k* 4)

and get a value of 12, etc. Indeed, we can substitute any value for the
third ordinal branch.

So my question is:

What's so special about the third branch?

Is there any reason I couldn't change the fourth branch, or second, or even
first?

Put another way, why doesn't the reified continuation k expose the
individual branches?






Posted on the users mailing list.