Re: Returning no value
- From: Geoffrey Summerhayes <sumrnot@xxxxxxxxx>
- Date: Wed, 30 Apr 2008 11:42:50 -0700 (PDT)
On Apr 30, 2:27 pm, dstein64 <DStei...@xxxxxxxxx> wrote:
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.
(defun foo()
(if (< 5 (random 10))
nil
(values)))
(loop for x below 10 appending (multiple-value-list (foo)))
---
Geoff
.
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) - loop variable value in finally forms?
... NIL; <- in finally ... In the first loop above, the final value is that computed after ... assigned (a third time). ... (comp.lang.lisp) |
|