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

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Jun 11 09:21:59 EDT 2008

On Jun 11, 2008, at 2:15 AM, John Clements wrote:

> 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.

It is great to see that you're teaching CPSing in an undergraduate PL  
course, the way life should be.


>
> 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?

I think so. Write a Redex model and run subject-reduction tests. This  
should be fairly easy.

-- Matthias



Posted on the users mailing list.