Tatsuhiko Kubo
cubic****@gmail*****
2008年 5月 14日 (水) 21:46:12 JST
はじめまして。久保と申します。 SennaQLの継続についてお聞きしたいのですが、 call-with-current-continuation(call/cc)を使って継続を生成した時の挙動が ほかのScheme処理系と異なります。 SennaQLでは、call/ccを使って生成した継続を保存して、 後で呼び出すといったことができないのですが、 これは何らかの要因があって意図的にこのような動作をするようになっているの でしょうか? よろしくお願いします。 ・SennaQLの場合 > (define (square x) (* x x)) square > (define cont #f) cont > (square (call-with-current-continuation (lambda (c) (set! cont c) (square 20)))) 160000 > cont #<CONTINUATION> > (cont 5) *** ERROR: Illegal function > ・Gaucheの場合 gosh> (define (square x) (* x x)) square gosh> (define cont #f) cont gosh> (square (call/cc (lambda (c) (set! cont c) (square 20)))) 160000 gosh> cont #<subr continuation> gosh> (cont 5) 25 gosh> ・Guileの場合 guile> (define (square x) (* x x)) guile> (define cont #f) guile> (square (call/cc (lambda (c) (set! cont c) (square 20)))) 160000 guile> cont #<continuation 1890 @ 818e00> guile> (cont 5) 25 guile>