X-Git-Url: http://git.kpe.io/?p=kmrcl.git;a=blobdiff_plain;f=lists.lisp;fp=lists.lisp;h=c33d845148e801d06f68524b746513023b88ba72;hp=ecdd003f993ec85dd20ee160f23017cb0c2eefb3;hb=f24004941eccdabb71485163d4bdf63ceea8dbf9;hpb=12026eac09e773e83887a6073d5a034979ce7043 diff --git a/lists.lisp b/lists.lisp index ecdd003..c33d845 100644 --- a/lists.lisp +++ b/lists.lisp @@ -163,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)) @@ -175,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)))