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?<div><br></div>
<div>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. </div><div><br></div><div>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:</div>
<div><br></div><div>(my/cc k (+ (+ 1 2) (+ 2 3) (+3 4)))</div><div><br></div><div>which you could use as (*k* position 12). </div><div><br></div><div>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. </div>
<div><br></div><div>Apologies if I misunderstood the question completely.</div><div> -Patrick</div><div><br><div class="gmail_quote">On Sat, Dec 1, 2012 at 4:28 PM, Galler <span dir="ltr"><<a href="mailto:lzgaller@optonline.net" target="_blank">lzgaller@optonline.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've been thinking about a reified continuation:<br>
<br>
The documentation (See Guide s10.3) says "A continuation is a value that<br>
encapsulates a piece of an expression context"<br>
<br>
I'm coming to the belief that the continuation is actually "an ordered<br>
collection of computation-branches, with facilities provided to manipulate<br>
one member of the collection"<br>
<br>
For example:<br>
<br>
(+ (+ 1 2) (let/cc k 3) (+ 2 3))<br>
<br>
which yields 11<br>
<br>
If we were to capture k in a module level variable *k*, we can substitute 4<br>
for the result of the third ordinal branch (counting from the left)<br>
<br>
(*k* 4)<br>
<br>
and get a value of 12, etc. Indeed, we can substitute any value for the<br>
third ordinal branch.<br>
<br>
So my question is:<br>
<br>
What's so special about the third branch?<br>
<br>
Is there any reason I couldn't change the fourth branch, or second, or even<br>
first?<br>
<br>
Put another way, why doesn't the reified continuation k expose the<br>
individual branches?<br>
<br>
<br>
<br>
<br>
<br>
____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</blockquote></div><br></div>