Re: Returning no value



dstein64 <DStein64@xxxxxxxxx> writes:

How do I have a function return no value (not even nil). I am
collecting elements using a loop. In the body, there is an if
statement, that returns a specific value in some instances and returns
nil otherwise. I do not want the 'collect' to collect the nils. That
is, I would like to have the else-form of my conditional return no
value, not nil. Thanks.

One option:

(loop ...
when (<your body with an if>)
collect it)

Zach
.



Relevant Pages

  • Re: Re: strange anomalies when using an iteration variable twice in 1 function
    ... >for loop control variables are reused, ... If the array is defined as you described, ... >arrayOfString is not defined the way you think it is. ... aTemplates:= nil; ...
    (alt.comp.lang.borland-delphi)
  • Re: loop variable value in finally forms?
    ... because I'd have never written the loop this way. ... is nil after the list is exhausted. ... internal and single user-given variables can be identical. ... the Iterate package currently behaves differently (it ...
    (comp.lang.lisp)
  • Re: Getting a number from a string
    ... (defun read-safely-from-string (str) ... (let ((*read-eval* nil)) ... (defun read-safely-from-string (string) ...
    (comp.lang.lisp)
  • Re: LOOP blows!
    ... My understanding of the LOOP specification is that your expectation is ... Even if the FOR Y = X clause were to work by stepping a hidden integer ... and evaluating at every iteration to pull out the ... The problem with these implementations that return NIL is that they ...
    (comp.lang.lisp)
  • Re: Loop for and behaviour
    ... This is SBCL 0.8.10.48, an implementation of ANSI Common Lisp. ... ; in: LAMBDA NIL ... I think what is happening here is that the loop is binding its own ...
    (comp.lang.lisp)