[racket] Tricky Continuations Problem

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Wed Sep 28 22:07:36 EDT 2011

I don't know about portable R6, but you might try using parameters
instead of set!; parameter values (set via parameterize) are captured
and restored when continuation jumps happen.

If something like that isn't around in R6, you might check to see if
you can do something with dynamic-wind.

hth,
Robby

On Wed, Sep 28, 2011 at 8:31 PM, Patrick Li <patrickli.2001 at gmail.com> wrote:
> Hello everyone,
> I am not that good with continuations, and am having trouble accomplishing
> what I want - which is quite trick. A little help and wisdom would be
> greatly appreciated.
> (define-special-computation-block
>   (let ((i 0))
>     ... computation block 1 ...
>     (yield) ;;suspend computation
>     (set! i 1)
>     ... computation block 2 ...
>     (yield) ;;suspend computation
>     (set! i 2)
>     ... computation block 3 ...
>     (yield) ;;suspend computation
>     (set! i 3)))
> The above code defines a piece of computation that can be suspended and
> resumed, and I got that part of it working properly using call/cc. However
> the computation also carries some state: the i variable. I would like to
> "save" the state of the computation after computation block 1, such that I
> can resume it from there over and over with i still equal to 0. Is this
> possible using portable R6RS scheme?
> Thanks very much for your help!
>   -Patrick
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>



Posted on the users mailing list.