[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mapcar and values interaction
- To: slug@ai.sri.com
- Subject: mapcar and values interaction
- From: gadbois@cs.utexas.edu (David Gadbois)
- Date: Mon, 4 Mar 1991 14:55:00 -0500
- In-reply-to: <9103041759.AA05430@gnome.local>
    Date: Mon, 4 Mar 91 10:59:36 -0700
    From: drstrip@gnome.cs.sandia.gov (David R. Strip)
    Why does (mapcar #'(lambda (x) (values)) '(1 2 3)) eval to (nil nil
    nil) and not ()?  In general, how do you write a function for use in
    a mapcar so that it may or may not contribute to the resulting list?
    strip
As for the first question, I don't know.  As for the second, the usual
idiom is:
    (mapcan #'(lambda (thing)
		(if (goodp thing)
		    (list thing)
		    '()))
	    some-list)
--David Gadbois