X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=lists.lisp;h=229bc91d6cc40d73bece0377d419db1d56a83ee4;hb=e2450e52a0813b8583395d7ac88f24e896f46e13;hp=35e74ba3482236cf8dd4f01cfc6948de66e273bd;hpb=eb3a19183eef0273cb4bec74259f98802fb141f0;p=kmrcl.git diff --git a/lists.lisp b/lists.lisp index 35e74ba..229bc91 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 &optional 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))