X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=lists.lisp;h=336baa02864fd29363c82ef90949aed6e6cfddae;hb=035b66e6fe51559e2db70691ddcae4ab641a4873;hp=35e74ba3482236cf8dd4f01cfc6948de66e273bd;hpb=eb3a19183eef0273cb4bec74259f98802fb141f0;p=kmrcl.git diff --git a/lists.lisp b/lists.lisp index 35e74ba..336baa0 100644 --- a/lists.lisp +++ b/lists.lisp @@ -42,13 +42,15 @@ (unless (find elem l1) (setq l1 (append l1 (list elem)))))) -(defun remove-from-tree-if (pred tree) +(defun remove-from-tree-if (pred tree atom-processor) "Strip from tree of atoms that satistify predicate" (if (atom tree) (unless (funcall pred tree) - tree) - (let ((car-strip (remove-from-tree-if pred (car tree))) - (cdr-strip (remove-from-tree-if pred (cdr tree)))) + (if atom-processor + (funcall atom-processor tree) + tree)) + (let ((car-strip (remove-from-tree-if pred (car tree) atom-processor)) + (cdr-strip (remove-from-tree-if pred (cdr tree) atom-processor))) (cond ((and car-strip (atom (cadr tree)) (null cdr-strip)) (list car-strip))