[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Non-stack-copying call-with-current-continuation?
From: |
David Kastrup |
Subject: |
Re: Non-stack-copying call-with-current-continuation? |
Date: |
Mon, 05 Mar 2012 02:44:04 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
Mark H Weaver <address@hidden> writes:
> However, catch/throw _will_ accept uninterned symbols created with
> 'make-symbol'.
Personally, I like uninterned symbols much better. They can be a bit
confusing in Lisp because they share print names, but one can't exactly
say that they do in Guile:
guile> (make-symbol "xxx")
#<uninterned-symbol xxx b7838a10>
guile>
Which feels a bit like gensym-on-demand, except that the serialization
happens by address rather than counting.
> Here's a faster implementation of call/ec that uses (list 'call/ec) to
> create prompt tags on Guile 2, and (make-symbol "call/ec") on earlier
> versions of Guile:
>
> (cond-expand
> (guile-2 (define (call-with-escape-continuation proc)
> (let ((tag (list 'call/ec)))
> (call-with-prompt
> tag
> (lambda () (proc (lambda xs (abort-to-prompt tag xs))))
> (lambda (k xs) (apply values xs))))))
>
> (guile (define (call-with-escape-continuation proc)
> (let ((key (make-symbol "call/ec")))
> (catch key
> (lambda () (proc (lambda xs (throw key xs))))
> (lambda (key xs) (apply values xs)))))))
>
> (define call/ec call-with-escape-continuation)
Given the constraints of current guile-1 and guile-2, I doubt that there
is much to take away anymore from this solution.
Thanks
--
David Kastrup
- Re: Non-stack-copying call-with-current-continuation?, (continued)
- Re: Non-stack-copying call-with-current-continuation?, Andreas Rottmann, 2012/03/03
- Re: Non-stack-copying call-with-current-continuation?, Andreas Rottmann, 2012/03/03
- Re: Non-stack-copying call-with-current-continuation?, Andy Wingo, 2012/03/03
- Re: Non-stack-copying call-with-current-continuation?, David Kastrup, 2012/03/04
- Re: Non-stack-copying call-with-current-continuation?, Andy Wingo, 2012/03/04
- Re: Non-stack-copying call-with-current-continuation?, David Kastrup, 2012/03/04
- Re: Non-stack-copying call-with-current-continuation?, Andy Wingo, 2012/03/04
- Re: Non-stack-copying call-with-current-continuation?, Mark H Weaver, 2012/03/04
- Re: Non-stack-copying call-with-current-continuation?, David Kastrup, 2012/03/04
- Re: Non-stack-copying call-with-current-continuation?, Mark H Weaver, 2012/03/04
- Re: Non-stack-copying call-with-current-continuation?,
David Kastrup <=
Re: Non-stack-copying call-with-current-continuation?, Nala Ginrut, 2012/03/01
Re: Non-stack-copying call-with-current-continuation?, Andy Wingo, 2012/03/03