Date: 2011-12-14 08:09 am (UTC)
Реплика новичка: барьеры континуаций в Racket -- это разве не оно?

Вот суть проблемы:
> (define saved-cont #f)
> (call-with-output-file* "file.txt" (lambda (out)
                                       (let/cc cont (set! saved-cont cont))
                                       (fprintf out "hello\n")) #:exists 'append)
    
> (saved-cont)
fprintf: output port is closed

А вот как она решается с помощью барьера:
> (call-with-continuation-barrier
   (lambda ()
     (call-with-output-file* "file.txt" (lambda (out) (let/cc cont (set! saved-cont cont))
                                         (fprintf out "hello\n")) #:exists 'append)))                                 
> (saved-cont)
continuation application: attempt to cross a continuation barrier
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

love5an: (Default)
Dmitry Ignatiev

June 2020

S M T W T F S
 123456
78910 111213
14151617181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 29th, 2025 09:38 pm
Powered by Dreamwidth Studios