Add remove-alist delete-alist
authorKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 20 Jun 2011 21:56:25 +0000 (15:56 -0600)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 20 Jun 2011 21:56:25 +0000 (15:56 -0600)
debian/changelog
kmrcl-tests.asd
kmrcl.asd
lists.lisp
macros.lisp
package.lisp

index 5cd6e8faecbc4815a315668375f8a9bdd4aee56e..e26b49e4820e575c93bef193c2e152bd5bf54220 100644 (file)
@@ -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
 
index da7de493daeed6e0e9c086107fea166385cf8c4a..331ee74d5a2e0220cea990acd045a91414a9eec3 100644 (file)
@@ -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))
 
index da12a61d4faac5ae9320fae91e824bd7b8c514d7..e53ba6a59636fe61f6d05a471e22fb84d373ebd8 100644 (file)
--- 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))))
index ecdd003f993ec85dd20ee160f23017cb0c2eefb3..c33d845148e801d06f68524b746513023b88ba72 100644 (file)
          (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))
   (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)))
 
index bf47c63bb005f95e00fbe86f043e37aa296658c9..c448b92e2c5ed4817bdf644d42edd5b0762a210f 100644 (file)
   `(/ (+ ,@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))
 
index f9d86335c1203e757ff6e5785a2e86204f681922..0f9bae3d0a0f8e106de9819037b403f8740ce875 100644 (file)
    #:alistp
    #:get-alist
    #:update-alist
+   #:remove-alist
+   #:delete-alist
    #:alist-plist
    #:plist-alist
    #:update-plist
    ;; mop.lisp
    #:short-arg-cesd
    #:short-arg-dsdc
+
+   ;; hash.lisp
+   #:print-hash
    ))