;; test-fn: #'(lambda(x) (and (integerp x) (> x 0))) ;; sort-fn #'(lambda (x y) (< x y))` (defmacro combine (l1 l2) `(nconc ,l1 ,l2)) (defun listproc (l test-fn sort-fn) (cond ((null l) nil) ((atom l) (if (funcall test-fn l) (list l) nil)) (t (sort (combine (listproc (car l) test-fn sort-fn) (listproc (cdr l) test-fn sort-fn)) sort-fn)))) (defun posint (l) (listproc l #'(lambda(x) (and (integerp x) (> x 0))) #'(lambda(x y) nil)))