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

From: Jacob Matthews (jacobm at gmail.com)
Date: Fri Mar 6 01:02:13 EST 2009

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.

-jacob

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

-jacob

> call/cc and let/ec also
> give this error. I think it's supposed to work, though. From the docs:
>
>    "The arguments supplied to an applied procedure become
>    the result values for the restored continuation. In
>    particular, if multiple arguments are supplied, then the
>    continuation receives multiple results."
>
> Neil
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.