Closed dyoo closed 11 years ago
This will be fixed when Whalesong's the evaluator; we're properly prompting the continuations there.
Following up: I'm confirming that under the prototype repl in Whalesong https://github.com/dyoo/whalesong/tree/repl this has the proper interaction:
> (define (make-gen gen) (let ([cont (box #f)]) (lambda () (call/cc (lambda (caller) (if (unbox cont) ((unbox cont) caller) (gen (lambda (v) (call/cc (lambda (gen-k) (begin (set-box! cont gen-k) (caller v)))))))))))) (define g1 (make-gen (lambda (return) (begin (return "a") (return "b") (return "c")))))
> (g1)
"a"
> (g1)
"b"
> (g1)
"c"
> (g1)
#<procedure:call/cc>
Closing issue, with the knowledge that this is fixed in the prototype evaluator Whalesong.
call/cc is completely broken in terms of REPL interactions. For example:
(define (make-gen gen) (let ([cont (box #f)]) (lambda () (call/cc (lambda (caller) (if (unbox cont) ((unbox cont) caller) (gen (lambda (v) (call/cc (lambda (gen-k) (begin (set-box! cont gen-k) (caller v))))))))))))
(define g1 (make-gen (lambda (return) (begin (return "a") (return "b") (return "c")))))
Calling g1 twice here does not show correct results.