<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div><br></div><div>Do you mean </div><div><br></div><div>   (define (state) (call/cc (lambda (x) x))) ;; that's the old name from some 1970's or early 1980's language that I can't recall </div><div><br></div><div>Try programming with it to find out why call/cc is so much better. -- Matthias</div><div><br></div><div><br></div><div><br></div><br><div><div>On Feb 7, 2009, at 10:13 AM, James Coglan wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br><br><div class="gmail_quote">2009/2/7 Matthew Flatt <span dir="ltr">&lt;<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><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_________________________________________________</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-converted-space">  </span>For list-related administrative tasks:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-converted-space">  </span><a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a></div> </blockquote></div><br></body></html>