[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] Fwd: Comments on draft 6 about call/cc
- To: oleg@x
- Subject: Re: [Scheme-reports] Fwd: Comments on draft 6 about call/cc
- From: Andy Wingo <wingo@x>
- Date: Sun, 19 Aug 2012 11:30:38 +0200
- Cc: scheme-reports@x
- In-reply-to: <20120222110157.33236.qmail@eeoth.pair.com> (oleg@okmij.org's message of "22 Feb 2012 11:01:57 -0000")
- References: <20120222110157.33236.qmail@eeoth.pair.com>
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