[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'or' and multiple values
From: |
Mark H Weaver |
Subject: |
Re: 'or' and multiple values |
Date: |
Tue, 25 Mar 2014 22:20:05 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Hi Neil,
Neil Jerram <address@hidden> writes:
> In the following, is the last result a bug?
>
> GNU Guile 2.0.9-deb+1-1
> Copyright (C) 1995-2013 Free Software Foundation, Inc.
>
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
>
> Enter `,help' for help.
> scheme@(guile-user)> (values 'a 'b)
> $1 = a
> $2 = b
> scheme@(guile-user)> (or (values 'a 'b))
> $3 = a
> $4 = b
> scheme@(guile-user)> (or #f (values 'a 'b))
> $5 = a
> $6 = b
> scheme@(guile-user)> (or (values 'a 'b) (values 'c 'd))
> $7 = a
>
> In other words it seems 'or' doesn't propagate multiple values in a
> non-tail position. Is that expected?
I think so, yes.
> The manual section 'Returning and Accepting Multiple Values' does
> mention tail position, but only in passing, and it isn't obvious to me
> why that restriction should exist.
'or' needs to test whether the results of the non-final expressions are
true or false. It's not clear how this should be generalized to
multiple values.
Mark