<br><br><div class="gmail_quote">2009/2/7 Matthew Flatt <span dir="ltr"><<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">At Sat, 7 Feb 2009 13:34:38 +0000, James Coglan wrote:<br>
> (begin<br>
> (call/cc<br>
> (lambda (k)<br>
> (set! r k)<br>
> #t))<br>
> (set! count-calls (+ count-calls 1)))<br>
> (r #t) (r #t) (r #t)<br>
><br>
> I would expect count-calls to equal 4 after this, but it equals 1. The<br>
> continuation, from what little I've read about this, should look like:<br>
><br>
> ([#procedure] [#hole] (set! count-calls (+ count-calls 1)))<br>
<br>
</div>The body of a top-level `begin' is spliced into the top-level sequence,<br>
so the `begin' above doesn't usefully group the two expressions. (To<br>
put it another way, a top-level `begin' wraps a prompt around each of<br>
its sub-expressions.)</blockquote><div><br>Thanks. Just out of curiosity, is there a function that simply returns the current continuation without jumping to another function using (call/cc)?<br></div></div><br>