[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Fwd: Comments on draft 6 about call/cc



Hi Oleg,

Apologies for reviving this very old thread, but I had a question.

On Wed 22 Feb 2012 12:01, oleg@x writes:

>Andy Wingo said:
>> [*] To implement a delimited call/cc on top of prompt and abort, you
>> would need an additional operator that captures a partial continuation,
>> but without unwinding the prompt. 
>
> Not at all: see the definition of the `delimited' call/cc (called
> cwcc) in terms of shift in Scheme48 distribution:
>
> http://www.s48.org/cgi-bin/hgwebdir.cgi/s48-stable/file/c975d6f20901/scheme/misc/shift-reset.scm
>
> (which has been there since about 1994).

Here is the implementation:
 
    (define cwcc
      (lambda (p)
        (shift k (k (p (lambda (x)
                         (shift k1 (k x))))))))

However, unless I misunderstand, this definition will exercise any
dynamic-wind that is between the reset and the shift, unlike Scheme's
call/cc which will not invoke any dynamic-winds.  That is the reason I
thought we would need a third operator.

Do you agree?

Regards,

Andy
-- 
http://wingolog.org/

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports