>>>>> "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.' ''
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
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.
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
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/
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
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.