X-Git-Url: http://git.kpe.io/?p=kmrcl.git;a=blobdiff_plain;f=lists.lisp;h=c33d845148e801d06f68524b746513023b88ba72;hp=a2ae23ff6c34d4c6ee20d0e2d7c1f426542d2018;hb=3ca593ad0ad02da7ebfd270523795674d6458ad3;hpb=c0e985428b4aa14bdc5a0688315bc4dbb5142ba3 diff --git a/lists.lisp b/lists.lisp index a2ae23f..c33d845 100644 --- a/lists.lisp +++ b/lists.lisp @@ -7,8 +7,6 @@ ;;;; 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 @@ -165,8 +163,8 @@ (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)) @@ -177,6 +175,14 @@ (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)))