From: Kevin M. Rosenberg Date: Mon, 20 Jun 2011 21:56:25 +0000 (-0600) Subject: Add remove-alist delete-alist X-Git-Tag: v1.104~1^2 X-Git-Url: http://git.kpe.io/?p=kmrcl.git;a=commitdiff_plain;h=131cfa94c7285e6c2a74205b6448eaabe12d0f1c Add remove-alist delete-alist --- diff --git a/debian/changelog b/debian/changelog index 5cd6e8f..e26b49e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,12 @@ +cl-kmrcl (1.104-1) unstable; urgency=low + + * lists.lisp: Add delete-alist and remove-alist + + -- Kevin M. Rosenberg Mon, 20 Jun 2011 15:55:57 -0600 + cl-kmrcl (1.103-1) unstable; urgency=low - * Remove UTF-8 code to allow compilation on CLISP + * Remove UTF-8 code to allow compilation on CLISP -- Kevin M. Rosenberg Sun, 05 Sep 2010 22:26:17 -0600 diff --git a/kmrcl-tests.asd b/kmrcl-tests.asd index da7de49..331ee74 100644 --- a/kmrcl-tests.asd +++ b/kmrcl-tests.asd @@ -22,5 +22,6 @@ (defmethod perform ((o test-op) (c (eql (find-system 'kmrcl-tests)))) (or (funcall (intern (symbol-name '#:do-tests) (find-package '#:regression-test))) - (error "test-op failed"))) + (error "test-op failed") + t)) diff --git a/kmrcl.asd b/kmrcl.asd index da12a61..e53ba6a 100644 --- a/kmrcl.asd +++ b/kmrcl.asd @@ -58,6 +58,7 @@ (:file "os" :depends-on ("macros" "impl")) (:file "signals" :depends-on ("package")) (:file "btree" :depends-on ("macros")) + (:file "hash" :depends-on ("macros")) )) (defmethod perform ((o test-op) (c (eql (find-system 'kmrcl)))) 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))) diff --git a/macros.lisp b/macros.lisp index bf47c63..c448b92 100644 --- a/macros.lisp +++ b/macros.lisp @@ -155,7 +155,7 @@ `(/ (+ ,@args) ,(length args))) (defmacro with-gensyms (syms &body body) - `(let ,(mapcar #'(lambda (s) `(,s (gensym))) + `(let ,(mapcar #'(lambda (s) `(,s (gensym ,(format nil "~A-" s)))) syms) ,@body)) diff --git a/package.lisp b/package.lisp index f9d8633..0f9bae3 100644 --- a/package.lisp +++ b/package.lisp @@ -142,6 +142,8 @@ #:alistp #:get-alist #:update-alist + #:remove-alist + #:delete-alist #:alist-plist #:plist-alist #:update-plist @@ -337,4 +339,7 @@ ;; mop.lisp #:short-arg-cesd #:short-arg-dsdc + + ;; hash.lisp + #:print-hash ))