chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] are values 1st-class?


From: Zbigniew
Subject: Re: [Chicken-users] are values 1st-class?
Date: Wed, 9 Aug 2006 20:06:46 -0500

Sorry, let  me clarify.  It is not illegal to pass multiple values to
a continuation expecting a single value--it's just unspecified (as
mentioned in the text).  Some implementations may error out when you
do so.  Chicken used to, but then it was changed to silently discard
every value except the first one, for convenience.  SISC appears to
pass multiple values in as a 'values object', so it behaves like you
expected.

On 8/9/06, Zbigniew <address@hidden> wrote:
No, this is not legal.  See R5RS 6.4:

"Except for continuations created by the call-with-values procedure,
all continuations take exactly one value. The effect of passing no
value or more than one value to continuations that were not created by
call-with-values is unspecified."

The existing macro RECEIVE will do what you want, though:

(receive (values 1 2))  ; => '(1 2)

On 8/9/06, Dan <address@hidden> wrote:
> (define (values->list v)
>   (call-with-values
>     (lambda () v)
>     (lambda x x)))
>
> (values->list (values 1 2))
>
> Returns (1 2) in SISC and Guile, (1) in Chicken. Are
> values supposed to be 1st-class objects? If not, I'll
> have to rewrite values->list as a macro -- right?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]