[racket] call/cc not working as expected in DrScheme

From: Bas Steunebrink (bas at idsia.ch)
Date: Thu Aug 19 13:04:49 EDT 2010

  Hi all,

 From what I understand about call/cc, when a saved continuation is 
invoked, the current continuation should be discarded. So I expected the 
following program to just print `stop?' once; however, it doesn't stop.


Welcome to DrScheme, version 4.2.4 [3m].
Language: Pretty Big; memory limit: 128 megabytes.
 > (define stop
     (let ((k (call-with-current-continuation (lambda (k) k))))
       (lambda ()
         (display "stop?\n")
         (k k))))
 > (begin (stop) (stop) 42)
stop?
stop?
42
 >


So is this an error in my understanding of call/cc or in DrScheme?

Regards,
Bas



Posted on the users mailing list.