X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=lists.lisp;h=336baa02864fd29363c82ef90949aed6e6cfddae;hb=1738d41053dae41266d5740385be9aac03a864ad;hp=bc2866498e00e67ef9cd8c509aa634c81a034028;hpb=d11d6cc43fd9227a8aeed28dc2cfecdbc587ec4a;p=kmrcl.git diff --git a/lists.lisp b/lists.lisp index bc28664..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)) @@ -169,7 +171,7 @@ (defun plist-alist (plist) (do ((alist '()) - (pl plist (cddr plist))) + (pl plist (cddr pl))) ((null pl) alist) (setq alist (acons (car pl) (cadr pl) alist))))