The subject is interesting, but I'm not sure I understand your question. As to "what's so special about the third branch?", isn't it special because that's where you put the let/cc?
i.e. If you wrote (+ (let/cc k 3) (+ 1 2) (+ 2 3)) instead of (+ (+ 1 2) (let/cc k 3) (+ 2 3)), then you would be able to change the 2nd branch instead of the 3rd. If you are asking for an interface for replacing any one of the individual "branches" with a value in the future, you could always write a macro: (my/cc k (+ (+ 1 2) (+ 2 3) (+3 4))) which you could use as (*k* position 12). my/cc and let/cc can each be written in terms of the other, so the question of which one is more fundamental is subject to debate. In the implementation of an interpreter, though, let/cc is very much simpler to implement than my/cc. Apologies if I misunderstood the question completely. -Patrick On Sat, Dec 1, 2012 at 4:28 PM, Galler <lzgal...@optonline.net> wrote: > 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? > > > > > > ____________________ > Racket Users list: > http://lists.racket-lang.org/users >
____________________ Racket Users list: http://lists.racket-lang.org/users