For Programmers: Free Programming Magazines  


Home > Archive > Scheme > January 2008 > Re: continuations in SML









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: continuations in SML
Michele Simionato

2008-01-12, 4:29 am

On Jan 11, 6:45 pm, Benedikt Rosenau
> You can turn it into a loop by using begin:
>
> (define-macro (store/cc! name . body)
> (let ((k (gensym)))
> `(call-with-current-continuation
> (lambda (,k) (set! ,name ,k) ,@body))))
>
> (define cont #f)
>
> (begin
> (display (+ 1 (store/cc! cont 0)))
> (cont 1))
>
> ; As opposed to not looping on:
> ; (display (+ 1 (store/cc! cont 0)))
> ; (cont 1)
>
> Is that what you mean with "typically ... forgiving"? It
> me when I tried to understand continuations.
> I wonder if this behavior is really not specified by R5RS.
> Any takers?


I am no expert. It is something I discovered when I was playing with
continuations in Scheme about 3 or 4 years ago and got me .
The same program when run as a compiled script is looping (the right
behavior) but when run from the REPL or as an interpreted script is
not looping. I did not like this behavior and I hoped that R6RS would
have fixed that but I see now that it is not the case (Ikarus Scheme
REPL diplays exactly the same behavior). Thinking a bit more I think
the problem is endemic: in a compiled script the concept of "rest of
computation" is clear, the entire program is known to the compiler; in
the REPL the compiler cannot know what the user will type next. So
there are basically two choices: the rest of the computation is
silently ignored or you raise an error. SML/NJ choose to raise an
error and I like that choice
better.
These matters are tricky and if I got them wrong (as it already
happened to me) feel free to correct
me.

Michele Simionato
Robzi_d

2008-01-21, 2:52 pm

Olsen Twins on couch tugging!
http://www.thetubebender.com/e?vid=726648

Pamela Anderson Nude Posing Home Made!
http://www.thetubebender.com/Player.mpeg?q=726648

Hilary Duff Wired pussy!
http://www.thetubebender.com/MediaPlayer.php?vid=726648

Heather Locklear shows off her cute body!
http://www.thetubebender.com/MediaPlayer?q=726648

Hilary Duff Dildos Her Pussy!
http://www.thetubebender.com/WatchMovie?watch=726648
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com