Skip to content
Snippets Groups Projects
Commit 131cfa94 authored by Kevin M. Rosenberg's avatar Kevin M. Rosenberg
Browse files

Add remove-alist delete-alist

parent b0508ddc
No related branches found
No related tags found
No related merge requests found
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 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 -- Kevin M. Rosenberg <kmr@debian.org> Sun, 05 Sep 2010 22:26:17 -0600
......
...@@ -22,5 +22,6 @@ ...@@ -22,5 +22,6 @@
(defmethod perform ((o test-op) (c (eql (find-system 'kmrcl-tests)))) (defmethod perform ((o test-op) (c (eql (find-system 'kmrcl-tests))))
(or (funcall (intern (symbol-name '#:do-tests) (or (funcall (intern (symbol-name '#:do-tests)
(find-package '#:regression-test))) (find-package '#:regression-test)))
(error "test-op failed"))) (error "test-op failed")
t))
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
(:file "os" :depends-on ("macros" "impl")) (:file "os" :depends-on ("macros" "impl"))
(:file "signals" :depends-on ("package")) (:file "signals" :depends-on ("package"))
(:file "btree" :depends-on ("macros")) (:file "btree" :depends-on ("macros"))
(:file "hash" :depends-on ("macros"))
)) ))
(defmethod perform ((o test-op) (c (eql (find-system 'kmrcl)))) (defmethod perform ((o test-op) (c (eql (find-system 'kmrcl))))
......
...@@ -163,8 +163,8 @@ ...@@ -163,8 +163,8 @@
(setf (cdr ,elem) ,val)) (setf (cdr ,elem) ,val))
(,alist (,alist
(setf (cdr (last ,alist)) (list (cons ,akey ,val)))) (setf (cdr (last ,alist)) (list (cons ,akey ,val))))
(t (t
(setf ,alist (list (cons ,akey ,val))))) (setf ,alist (list (cons ,akey ,val)))))
,alist))) ,alist)))
(defun get-alist (key alist &key (test #'eql)) (defun get-alist (key alist &key (test #'eql))
...@@ -175,6 +175,14 @@ ...@@ -175,6 +175,14 @@
(update-alist key value alist :test test) (update-alist key value alist :test test)
value) 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) (defun alist-plist (alist)
(apply #'append (mapcar #'(lambda (x) (list (car x) (cdr x))) alist))) (apply #'append (mapcar #'(lambda (x) (list (car x) (cdr x))) alist)))
......
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
`(/ (+ ,@args) ,(length args))) `(/ (+ ,@args) ,(length args)))
(defmacro with-gensyms (syms &body body) (defmacro with-gensyms (syms &body body)
`(let ,(mapcar #'(lambda (s) `(,s (gensym))) `(let ,(mapcar #'(lambda (s) `(,s (gensym ,(format nil "~A-" s))))
syms) syms)
,@body)) ,@body))
......
...@@ -142,6 +142,8 @@ ...@@ -142,6 +142,8 @@
#:alistp #:alistp
#:get-alist #:get-alist
#:update-alist #:update-alist
#:remove-alist
#:delete-alist
#:alist-plist #:alist-plist
#:plist-alist #:plist-alist
#:update-plist #:update-plist
...@@ -337,4 +339,7 @@ ...@@ -337,4 +339,7 @@
;; mop.lisp ;; mop.lisp
#:short-arg-cesd #:short-arg-cesd
#:short-arg-dsdc #:short-arg-dsdc
;; hash.lisp
#:print-hash
)) ))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment