Hi David, On Fri 02 Mar 2012 01:00, David Kastrup <d...@gnu.org> writes:
> Is there a way to get a call-with-current-continuation that does not > create a stack copy? This is usually referred to as `call-with-escape-continuation'. For example, here are Racket's words on the topic: http://docs.racket-lang.org/reference/cont.html#(def._((quote._~23~25kernel)._call-with-escape-continuation)) Here is a good definition of call/ec in Guile: (define (call/ec proc) (let ((tag (make-prompt-tag))) (define (abort . args) (abort-to-prompt tag args)) (call-with-prompt tag (lambda () (proc abort)) (lambda (k args) (apply values args))))) That one won't work in Guile 1.8 though. A portable definition: (define (call/ec proc) (let ((key (gensym "escape "))) (define (abort . args) (throw key args)) (catch key (lambda () (proc abort)) (lambda (key args) (apply values args))))) Regards, Andy -- http://wingolog.org/