[plt-scheme] call/cc and values

From: Carl Eastlund (carl.eastlund at gmail.com)
Date: Wed Feb 15 15:54:35 EST 2006

On 2/15/06, pedro pinto <pedro.e.pinto at gmail.com> wrote:
> Hi there,
> Should this work?
> (let/ec return
>   (return (values 1 2)))
> If not, why not?

This won't work.  You are applying "return" as a function, and as its
first argument, giving it two values.  Each argument position expects
only one value.  If you want to pass two values into an explicit
continuation the same way (values 1 2) passes two values into a
continuation, you want to use call-with-values like this:

(let/ec return (call-with-values (lambda () (values 1 2)) return))

Carl Eastlund
"Cynical, but technically correct."

Posted on the users mailing list.