[plt-scheme] call/cc and values

From: Jacob Matthews (jacobm at cs.uchicago.edu)
Date: Wed Feb 15 16:00:37 EST 2006

pedro pinto wrote:

> Should this work?
> (let/ec return
>   (return (values 1 2)))


> If not, why not?

The let/ec is misleading here, it has nothing to do with the error. The 
problem is no different from the error you'd get if you wrote

(let ((return (lambda (x) x)))
  (return (values 1 2)))

All applications of anything to anything require that the argument 
expressions each evaluate to a _single_ value. In these two examples, 
that requirement isn't met, so there's an error.

You _can_ get the behavior I suspect you want, but not the way you've 
done it. You've got to do

(let/ec return
  (return 1 2))

which evaluates to two values, 1 and 2.


Posted on the users mailing list.