unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* 'or' and multiple values
@ 2014-03-26  1:36 Neil Jerram
  2014-03-26  2:20 ` Mark H Weaver
  0 siblings, 1 reply; 2+ messages in thread
From: Neil Jerram @ 2014-03-26  1:36 UTC (permalink / raw)
  To: guile-user

Hi there!

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?

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.

Thanks,
        Neil



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: 'or' and multiple values
  2014-03-26  1:36 'or' and multiple values Neil Jerram
@ 2014-03-26  2:20 ` Mark H Weaver
  0 siblings, 0 replies; 2+ messages in thread
From: Mark H Weaver @ 2014-03-26  2:20 UTC (permalink / raw)
  To: Neil Jerram; +Cc: guile-user

Hi Neil,

Neil Jerram <neil@ossau.homelinux.net> 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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-26  2:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-26  1:36 'or' and multiple values Neil Jerram
2014-03-26  2:20 ` Mark H Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).