Subject: Re: (funcall #'or my-list)
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 07 Sep 2007 19:46:01 -0500
Newsgroups: comp.lang.lisp
Message-ID: <RYCdnVJAHqpUbXzbnZ2dnUVZ_orinZ2d@speakeasy.net>
Rob St. Amant <stamant@ncsu.edu> wrote:
+---------------
| Oops, I replied too soon.  The point of the functions is to collect
| results of the predicate rather than the elements themselves, for
| which remove-if and friends are appropriate.  Perhaps this revision:
| 
| (defun collect (x list &key (key 'identity) (test 'eql))
|   (loop for i in list
|         when (funcall test x (funcall key i))
|         collect it)) ; it rather than i
| 
| (defun collect-if (test list)
|   (loop for i in list
|         when (funcall test i)
|         collect it)) ; it rather than i
+---------------

What's wrong with just (remove-if #'null (mapcar PREDICATE SEQUENCE))?


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607