Add recommended targets to debian/rules
[kmrcl.git] / lists.lisp
index eaa3f9d372aa601d079d6f24ead4798bc17ea467..c33d845148e801d06f68524b746513023b88ba72 100644 (file)
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; KMRCL users are granted the rights to distribute and use this software
@@ -76,9 +74,9 @@
 (defun flatten (tree)
   (let ((result '()))
     (labels ((scan (item)
 (defun flatten (tree)
   (let ((result '()))
     (labels ((scan (item)
-               (if (listp item)
-                 (map nil #'scan item)
-                 (push item result))))
+               (if (consp item)
+                   (map nil #'scan item)
+                   (push item result))))
       (scan tree))
     (nreverse result)))
 
       (scan tree))
     (nreverse result)))
 
          (setf (cdr ,elem) ,val))
         (,alist
          (setf (cdr (last ,alist)) (list (cons ,akey ,val))))
          (setf (cdr ,elem) ,val))
         (,alist
          (setf (cdr (last ,alist)) (list (cons ,akey ,val))))
-         (t
-          (setf ,alist (list (cons ,akey ,val)))))
+        (t
+         (setf ,alist (list (cons ,akey ,val)))))
        ,alist)))
 
 (defun get-alist (key alist &key (test #'eql))
        ,alist)))
 
 (defun get-alist (key alist &key (test #'eql))
   (update-alist key value alist :test test)
   value)
 
   (update-alist key value alist :test test)
   value)
 
+(defun remove-alist (key alist &key (test #'eql))
+  "Removes a key from an alist."
+  (remove key alist :test test :key #'car))
+
+(defun delete-alist (key alist &key (test #'eql))
+  "Deletes a  key from an alist."
+  (delete key alist :test test :key #'car))
+
 (defun alist-plist (alist)
   (apply #'append (mapcar #'(lambda (x) (list (car x) (cdr x))) alist)))
 
 (defun alist-plist (alist)
   (apply #'append (mapcar #'(lambda (x) (list (car x) (cdr x))) alist)))