[plt-scheme] Problem with call/cc and multiple values

From: Neil Toronto (ntoronto at cs.byu.edu)
Date: Fri Mar 6 01:18:00 EST 2009

Jacob Matthews wrote:
> On Thu, Mar 5, 2009 at 9:43 PM, Neil Toronto <ntoronto at cs.byu.edu> wrote:
>> I'm using DrScheme 4.1.3. Here's the problem:
>>
>>    > (values 1 2)
>>    1
>>    2
>>    > (let/cc return
>>        (return (values 1 2)))
>>    . . context expected 1 value, received 2 values: 1 2
> 
> try (let/cc return (return 1 2)) instead.

Ah, right. D'oh!

>> The context is definitely not expecting one value.
> 
> the context of the continuation named by return may be expecting
> multiple values, but the context (return [-]) is expecting one value.
> It's just a generic function application context that's waiting for an
> argument. It doesn't distinguish between applications of functions
> that happen to represent continuation objects versus other kinds of
> functions.

That makes plenty good sense. Thanks!

Neil



Posted on the users mailing list.