[plt-scheme] call/cc and values
On Feb 15, 2006, at 12:54 PM, Carl Eastlund wrote:
> 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 is right. I'm wrong. Thanks, Carl!
John
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2430 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20060215/b33a3cc5/attachment.p7s>