From: Coby Beck
Subject: does loop return nil
Date: 
Message-ID: <951435338725@NewsSIEVE.cs.bonn.edu>
I tried but can't find it in so many words in the hyperspec:

Can I count on LOOP to return nil unless it is told otherwise?

Coby

From: Russell Senior
Subject: Re: does loop return nil
Date: 
Message-ID: <86og96yvza.fsf@coulee.tdb.com>
>>>>> "Coby" == Coby Beck <·····@mercury.bc.ca> writes:

Coby> I tried but can't find it in so many words in the hyperspec: Can
Coby> I count on LOOP to return nil unless it is told otherwise?

Define `told otherwise'.


-- 
Russell Senior         ``The two chiefs turned to each other.        
·······@aracnet.com      Bellison uncorked a flood of horrible       
                         profanity, which, translated meant, `This is
                         extremely unusual.' ''                      
From: Coby Beck
Subject: Re: does loop return nil
Date: 
Message-ID: <951439555416@NewsSIEVE.cs.bonn.edu>
Russell Senior <·······@aracnet.com> wrote in message
···················@coulee.tdb.com...
> >>>>> "Coby" == Coby Beck <·····@mercury.bc.ca> writes:
>
> Coby> I tried but can't find it in so many words in the hyperspec: Can
> Coby> I count on LOOP to return nil unless it is told otherwise?
>
> Define `told otherwise'.
>
>

What i meant was unless explicitly returning a value with a 'return' form or
using 'collect'
(sorry if i was being "cute")

Coby
From: Barry Margolin
Subject: Re: does loop return nil
Date: 
Message-ID: <2nkt4.32$I31.1032@burlma1-snr2>
In article <············@NewsSIEVE.cs.bonn.edu>,
Coby Beck <·····@mercury.bc.ca> wrote:
>I tried but can't find it in so many words in the hyperspec:
>
>Can I count on LOOP to return nil unless it is told otherwise?

I suspect that all implementations do (what else are they going to put in
the RETURN or RETURN-FROM form if there's no value accumulation being
done?), but there's no requirement to do so.  So don't depend on it.

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Robert Monfera
Subject: Re: does loop return nil
Date: 
Message-ID: <38B5D565.681BF9D4@fisec.com>
Barry Margolin wrote:

> >Can I count on LOOP to return nil unless it is told otherwise?
>
> I suspect that all implementations do (what else are they going to put > in
> the RETURN or RETURN-FROM form if there's no value accumulation being
> done?)

(loop for a from 1 upto 10 return (values))

which, I guess, is the same as returning nil for all practical purposes.

Robert
From: Rainer Joswig
Subject: Re: does loop return nil
Date: 
Message-ID: <rainer.joswig-55CB79.09430425022000@news.is-europe.net>
In article <·················@fisec.com>, Robert Monfera 
<·······@fisec.com> wrote:

> Barry Margolin wrote:
> 
> > >Can I count on LOOP to return nil unless it is told otherwise?
> >
> > I suspect that all implementations do (what else are they going to put > in
> > the RETURN or RETURN-FROM form if there's no value accumulation being
> > done?)
> 
> (loop for a from 1 upto 10 return (values))
> 
> which, I guess, is the same as returning nil for all practical purposes.
> 
> Robert

No, (values) returns no values at all. NIL is a value.

? (values)
? (values nil)
NIL
? nil
NIL

Rainer Joswig, ISION Internet AG, Harburger Schlossstrasse 1, 
21079 Hamburg, Germany, Tel: +49 40 77175 226
Email: ·············@ision.de , WWW: http://www.ision.de/
From: Robert Monfera
Subject: Re: does loop return nil
Date: 
Message-ID: <38B68E55.A9D55B8@fisec.com>
Rainer Joswig wrote:

> > which, I guess, is the same as returning nil for all practical purposes.
> >
> > Robert
>
> No, (values) returns no values at all. NIL is a value.

You are perfectly right, that's why I used the satisfactorily vague "for
all practical purposes".

What I meant by that is that if no function is taking the result of
loop, it does not matter.  If there is a function that would rely on a
return value, it will use NIL:

(null (values)) -> T

(list (values) (values)) -> (NIL NIL)

(multiple-value-bind (a b) (values) (list a b)) -> (NIL NIL)

This one shows the truth though:

(length (multiple-value-list (values))) -> 0

Robert
From: Fernando D. Mato Mira
Subject: Re: does loop return nil
Date: 
Message-ID: <38B69DE8.159DBEC5@iname.com>
Robert Monfera wrote:

> (list (values) (values)) -> (NIL NIL)

(multiple-value-call #'list (values) (values)) -> NIL

--
Fernando D. Mato Mira
Real-Time SW Eng & Networking
Advanced Systems Engineering Division
CSEM
Jaquet-Droz 1                   email: matomira AT acm DOT org
CH-2007 Neuchatel                 tel:       +41 (32) 720-5157
Switzerland                       FAX:       +41 (32) 720-5720

www.csem.ch      www.vrai.com     ligwww.epfl.ch/matomira.html
From: Barry Margolin
Subject: Re: does loop return nil
Date: 
Message-ID: <0XAt4.65$I31.1657@burlma1-snr2>
In article <·················@iname.com>,
Fernando D. Mato Mira <········@iname.com> wrote:
>Robert Monfera wrote:
>
>> (list (values) (values)) -> (NIL NIL)
>
>(multiple-value-call #'list (values) (values)) -> NIL

Go back to his "for all practical purposes" qualifier.  No one would use
MULTIPLE-VALUE-CALL or MULTIPLE-VALUE-LIST in cases where the number of
values being returned isn't part of the documented interface.

In most cases, you can ignore extra values and missing expected values
become NIL.  You have to go out of your way to detect the differnce between
(VALUES) and NIL.

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.