This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How often are continuations created?


Keisuke Nishida <kxn30@po.cwru.edu> writes:

> Oh, should it?  But Guile does restart it from 0:
> 
>   guile> (define some-cont #f)
>   guile> (define magic-computation
>            (let ((capture #t))
>              (lambda (x)
>                (if capture
>                    (begin
>                      (set! capture #f)
>                      (set! some-cont (call-with-current-continuation id)))))))
>   guile> (do ((v (make-vector 5 #f))
>               (i 0 (1+ i)))
>              ((= i 5))
>            (vector-set! v i (magic-computation i))
>            (display i))
>   01234guile> (some-cont #f)
>   01234guile> 
> 
> Which one is the correct behavior?

Miroslav is right.
Guile is wrong.

This is a Guile bug.

/mdj

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]