[plt-scheme] Fun with Unicode and delimited continuations
On Jun 4, 2010, at 1:45 PM, Sam Tobin-Hochstadt wrote:
> They're one-shot in that they can only be invoked once - after that,
> they change to do something else. Consider this implementation of
> `call/cc':
>
> (define (call/cc* f)
> (let/cc k
> (let* ([v #f]
> [k* (lambda (e) (if v (error 'too-many) (begin (set! v #t) (k e)))])
> (f k*))))
>
> This implements a first-class, full continuation that can only be used
> once. You can pass it back out, invoke it from anywhere, but after
> one use it errors. That's a one-shot continuation.
Please re-read Friedman and Haynes. At a min, run (k* (f k*)).
>> (My true point is that they aren't continuation at all. You can use continuations in the denotational sense to explain them but I think you can get away with something much much simpler: procedure-local continuations, and they are NOT first-class.)
>
> You can explain them as coroutines, as the paper I pointed to does.
Of course you can, I have done so in the past myself.