From: Thaddeus L Olczyk
Subject: Multiple-value-list with no values.
Date: 
Message-ID: <3c56a168.27569296@nntp.interaccess.com>
What is the supposed to be the result of multiple-value-list if it
acts on a value that has no elements.

From: Jochen Schmidt
Subject: Re: Multiple-value-list with no values.
Date: 
Message-ID: <3C54C8F5.6060706@dataheaven.de>
Thaddeus L Olczyk wrote:
> What is the supposed to be the result of multiple-value-list if it
> acts on a value that has no elements.

A look into the HyperSpec shows:
(multiple-value-list form) ==  (multiple-value-call #'list form)

So your question gets simplified to the question what is supposed
to be the result of (list) which is obviously the empty list.

ciao,
Jochen
From: Thaddeus L Olczyk
Subject: Re: Multiple-value-list with no values.
Date: 
Message-ID: <3c5501d5.52254640@nntp.interaccess.com>
gOn Mon, 28 Jan 2002 04:43:49 +0100, Jochen Schmidt
<···@dataheaven.de> wrote:

>Thaddeus L Olczyk wrote:
>> What is the supposed to be the result of multiple-value-list if it
>> acts on a value that has no elements.
>
>A look into the HyperSpec shows:
>(multiple-value-list form) ==  (multiple-value-call #'list form)
>
>So your question gets simplified to the question what is supposed
>to be the result of (list) which is obviously the empty list.
>
>ciao,
>Jochen
Welll Clisp returns (nil).
From: Bruce Hoult
Subject: Re: Multiple-value-list with no values.
Date: 
Message-ID: <bruce-645E41.20561328012002@news.paradise.net.nz>
In article <·················@nntp.interaccess.com>, 
······@interaccess.com wrote:

> gOn Mon, 28 Jan 2002 04:43:49 +0100, Jochen Schmidt
> <···@dataheaven.de> wrote:
> 
> >Thaddeus L Olczyk wrote:
> >> What is the supposed to be the result of multiple-value-list if it
> >> acts on a value that has no elements.
> >
> >A look into the HyperSpec shows:
> >(multiple-value-list form) ==  (multiple-value-call #'list form)
> >
> >So your question gets simplified to the question what is supposed
> >to be the result of (list) which is obviously the empty list.
> >
> >ciao,
> >Jochen
> Welll Clisp returns (nil).

That doesn't sound right.  Are you sure you aren't just seeing the 
default nil value from binding to more variables than there are values 
in the multiple-values?

e.g. (using Dylan syntax, sorry, it's more familiar, especiall the #rest 
part at the end)

   let (a, b, c, d) = values(1, 2);

c and d get #f.  In CL they'll get nil.  For the same reason, x will get 
#f/nil:

  let x = values();

But if you do...

  let (#rest z) = values();

... then z is an empty sequence.

-- Bruce
From: Thomas F. Burdick
Subject: Re: Multiple-value-list with no values.
Date: 
Message-ID: <xcvu1t6q50w.fsf@conquest.OCF.Berkeley.EDU>
Bruce Hoult <·····@hoult.org> writes:

> In article <·················@nntp.interaccess.com>, 
> ······@interaccess.com wrote:
> 
> > gOn Mon, 28 Jan 2002 04:43:49 +0100, Jochen Schmidt
> > <···@dataheaven.de> wrote:
> > 
> > >Thaddeus L Olczyk wrote:
> > >> What is the supposed to be the result of multiple-value-list if it
> > >> acts on a value that has no elements.
> > >
> > >A look into the HyperSpec shows:
> > >(multiple-value-list form) ==  (multiple-value-call #'list form)
> > >
> > >So your question gets simplified to the question what is supposed
> > >to be the result of (list) which is obviously the empty list.
> > >
> > >ciao,
> > >Jochen
> > Welll Clisp returns (nil).
> 
> That doesn't sound right.

No, it doesn't.  And in the copy of CLISP I have handy (2000-03-06), I
get NIL.  If there are any versions of CLISP that return (NIL) here,
that's a bug and should be reported (unless they're really really old...)

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Thaddeus L Olczyk
Subject: Re: Multiple-value-list with no values.
Date: 
Message-ID: <3c570994.54237125@nntp.interaccess.com>
On 28 Jan 2002 00:00:15 -0800, ···@conquest.OCF.Berkeley.EDU (Thomas
F. Burdick) wrote:

>Bruce Hoult <·····@hoult.org> writes:
>
>> In article <·················@nntp.interaccess.com>, 
>> ······@interaccess.com wrote:
>> 
>> > gOn Mon, 28 Jan 2002 04:43:49 +0100, Jochen Schmidt
>> > <···@dataheaven.de> wrote:
>> > 
>> > >Thaddeus L Olczyk wrote:
>> > >> What is the supposed to be the result of multiple-value-list if it
>> > >> acts on a value that has no elements.
>> > >
>> > >A look into the HyperSpec shows:
>> > >(multiple-value-list form) ==  (multiple-value-call #'list form)
>> > >
>> > >So your question gets simplified to the question what is supposed
>> > >to be the result of (list) which is obviously the empty list.
>> > >
>> > >ciao,
>> > >Jochen
>> > Welll Clisp returns (nil).
>> 
>> That doesn't sound right.
>
>No, it doesn't.  And in the copy of CLISP I have handy (2000-03-06), I
>get NIL.  If there are any versions of CLISP that return (NIL) here,
>that's a bug and should be reported (unless they're really really old...)
I just tried:
(setf x (values-list nil))
(multiple-values-list x)
=>(nil)
version 2.27

Actually it came about because of something different I was doing:
(use-package "REGEXP")
(setf s "abcdef")
(setf reg-exp-match (multiple-value-list (match 'ghi" s)))
(if (not (nul reg-exp-match)) 
     (princ (subseq s (match-begin (car reg-exp-match)) 
                                (match-end   (car reg-exp-match)))))

where the princ crashes because (car reg-exp-match) is nil.
Actually it turns out that reg-exp-match is (nil).
From: Pierre R. Mai
Subject: Re: Multiple-value-list with no values.
Date: 
Message-ID: <87ofje3e79.fsf@orion.bln.pmsf.de>
······@interaccess.com (Thaddeus L Olczyk) writes:

> >No, it doesn't.  And in the copy of CLISP I have handy (2000-03-06), I
> >get NIL.  If there are any versions of CLISP that return (NIL) here,
> >that's a bug and should be reported (unless they're really really old...)

> I just tried:
> (setf x (values-list nil))
> (multiple-values-list x)
> =>(nil)
> version 2.27

[ I assume you meant multiple-value-list in the above, otherwise CLISP
  should have signalled an error. ]

That is completely correct behaviour:

- (values-list nil) produces 0 values, but since the right-hand side
  of the setf form will require exactly 1 value, that value is
  defaulted to nil, so x gets set to nil.
- (multiple-value-list nil) must return (nil), since evaluating nil
  yields exactly 1 value, namely nil, which is then returned.

To test what you wanted to test, you can do:

(multiple-value-list (values-list nil))

which yields nil, as expected.

You should be aware that multiple values deteriorate to 1 value in all
contexts other than those which are specified to handle
multiple-values specially, like e.g. m-v-bind, m-v-call, m-v-list, but
also progn, etc.

> Actually it came about because of something different I was doing:
> (use-package "REGEXP")
> (setf s "abcdef")
> (setf reg-exp-match (multiple-value-list (match 'ghi" s)))
> (if (not (nul reg-exp-match)) 
>      (princ (subseq s (match-begin (car reg-exp-match)) 
>                                 (match-end   (car reg-exp-match)))))
> 
> where the princ crashes because (car reg-exp-match) is nil.
> Actually it turns out that reg-exp-match is (nil).

That would indicate that match returns nil, and not 0 values.

Regs, Pierre.

-- 
Pierre R. Mai <····@acm.org>                    http://www.pmsf.de/pmai/
 The most likely way for the world to be destroyed, most experts agree,
 is by accident. That's where we come in; we're computer professionals.
 We cause accidents.                           -- Nathaniel Borenstein
From: Thaddeus L Olczyk
Subject: Re: Multiple-value-list with no values.
Date: 
Message-ID: <3c566954.78749953@nntp.interaccess.com>
On 28 Jan 2002 12:30:34 +0100, "Pierre R. Mai" <····@acm.org> wrote:

>[ I assume you meant multiple-value-list in the above, otherwise CLISP
>  should have signalled an error. ]
Yes. I always get confused whther the s goes with values-list or
multiple-value-list and once in a while make the typo.
I think it was a big mistake to name these two differently and they
should
have settled on values or value. The way it is now is just error
prone.