From 131cfa94c7285e6c2a74205b6448eaabe12d0f1c Mon Sep 17 00:00:00 2001
From: "Kevin M. Rosenberg" <kevin@rosenberg.net>
Date: Mon, 20 Jun 2011 15:56:25 -0600
Subject: [PATCH] Add remove-alist delete-alist

---
 debian/changelog |  8 +++++++-
 kmrcl-tests.asd  |  3 ++-
 kmrcl.asd        |  1 +
 lists.lisp       | 12 ++++++++++--
 macros.lisp      |  2 +-
 package.lisp     |  5 +++++
 6 files changed, 26 insertions(+), 5 deletions(-)

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 <kmr@debian.org>  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 <kmr@debian.org>  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
    ))
-- 
GitLab