[racket] call-with-composable-continuation vs. call/cc

From: Gregory Woodhouse (gregwoodhouse at me.com)
Date: Sun Mar 20 17:58:46 EDT 2011

If I write a trivial loop using call/cc

(call/cc
 (lambda (k)
   (define (loop)
     (let ([x (read)])
       (if (eq? x '())
           (k x)
           (loop))))
   (loop)))

It does exactly what I expect. If I type anything but () it reads again, but if I type () it prints out '() and quits

Welcome to DrRacket, version 5.1 [3m].
Language: racket; memory limit: 256 MB.
hello <-- user input
'() <-- user input
() <-- user input
'() <-- output
> 

but if I change call/cc to call-with-composable-continuatiom I see '() printed twice

Welcome to DrRacket, version 5.1 [3m].
Language: racket; memory limit: 256 MB.
hello <-- user input
() <-- user input
'() <-- output
'() <-- output
> 

Why is this?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4372 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20110320/b30e0a37/attachment.p7s>

Posted on the users mailing list.