I've had to re-implement a particular function in pretty much every Lisp program I've ever written. Since this function is so useful, it must have been implemented before. I'd expect it to be well known. Perhaps it is part of Common Lisp's standard library. What is it called and what library is it from?
(defun unknown-function (predicate tree)
(loop for item in tree
if (funcall predicate item) collect item
else if (listp item) append (unknown-function predicate item)))
It descends through a tree and creates a flat list of all the nodes in that tree that satisfy the predicate.