[plt-scheme] simple question about call/cc?

From: John Clements (clements at brinckerhoff.org)
Date: Wed Jun 11 02:15:54 EDT 2008

I'm grading student assignments, and their job is to convert  
evaluators to CPS so that implementing continuations is easy. In my  
sample solution, I evaluate all the arguments in the current  
continuation and then, if the function position evaluates to a  
continuation, I apply the enclosed continuation procedure (c) rather  
than the current k to the value that corresponds to the first argument.

All fine and well.

Some of my students, though, discover whether the function is a  
continuation before evaluating the argument; if it is, they evaluate  
the argument using c as the continuation.

As I thought about this, though, it occurred to me that unless you  
have "fancy stuff" like escape continuations, dynamic wind, or  
continuation marks, you can't distinguish between these two  
implementations except by measuring memory use.  That's because a  
continuation captured in this context is going to have a long  
"tail" (or not) that can never be observed unless you have some  
operation on the continuation other than simply calling it.

Am I correct?

John Clements

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20080610/91706fb4/attachment.p7s>

Posted on the users mailing list.