diff -Nru cl-alexandria-0.0.20091125/debian/changelog cl-alexandria-0.0.20100217/debian/changelog --- cl-alexandria-0.0.20091125/debian/changelog 2010-05-09 15:24:55.000000000 +0100 +++ cl-alexandria-0.0.20100217/debian/changelog 2010-05-09 15:24:55.000000000 +0100 @@ -1,3 +1,10 @@ +cl-alexandria (0.0.20100217-1) unstable; urgency=low + + * New upstream release. + * Fixed typo in description. (Closes: #563767) + + -- Peter Van Eynde Tue, 02 Mar 2010 08:19:13 +0100 + cl-alexandria (0.0.20091125-1) unstable; urgency=low * New upstream with minor changes. diff -Nru cl-alexandria-0.0.20091125/debian/control cl-alexandria-0.0.20100217/debian/control --- cl-alexandria-0.0.20091125/debian/control 2010-05-09 15:24:55.000000000 +0100 +++ cl-alexandria-0.0.20100217/debian/control 2010-05-09 15:24:55.000000000 +0100 @@ -16,7 +16,7 @@ Description: A collection of portable Common Lisp utilities alexandria is a collection of utilities in the public domain for Common Lisp . - It is a library but also a project that aims to reduce duplication of efforti + It is a library but also a project that aims to reduce duplication of effort and improve portability of Common Lisp code according to its own idiosyncratic and rather conservative aesthetic. . diff -Nru cl-alexandria-0.0.20091125/lists.lisp cl-alexandria-0.0.20100217/lists.lisp --- cl-alexandria-0.0.20091125/lists.lisp 2009-12-31 14:32:07.000000000 +0000 +++ cl-alexandria-0.0.20100217/lists.lisp 2010-03-08 16:30:12.000000000 +0000 @@ -26,34 +26,43 @@ (defun racons (key value ralist) (acons value key ralist)) -(macrolet ((define-alist-get (name get-pair get-value-from-pair add doc) - `(progn - (declaim (inline ,name)) - (defun ,name (alist key &key (test 'eql)) - ,doc - (let ((pair (,get-pair key alist :test test))) - (values (,get-value-from-pair pair) pair))) - (define-setf-expander ,name (place key &key (test ''eql) - &environment env) - (multiple-value-bind (dummies vals newvals setter getter) - (get-setf-expansion place env) - (when (cdr newvals) - (error "~A cannot store multiple values in one place" ',name)) - (with-unique-names (store key-val test-val alist found) - (values - (append dummies (list key-val test-val)) - (append vals (list key test)) - (list store) - `(let ((,alist ,getter)) - (let ((,found (,',get-pair ,key-val ,alist :test ,test-val))) - (cond (,found - (setf (,',get-value-from-pair ,found) ,store)) - (t - (let ,newvals - (setf ,(first newvals) (,',add ,key ,store ,alist)) - ,setter))) - ,store)) - `(,',name ,getter ,key)))))))) +(macrolet + ((define-alist-get (name get-entry get-value-from-entry add doc) + `(progn + (declaim (inline ,name)) + (defun ,name (alist key &key (test 'eql)) + ,doc + (let ((entry (,get-entry key alist :test test))) + (values (,get-value-from-entry entry) entry))) + (define-setf-expander ,name (place key &key (test ''eql) + &environment env) + (multiple-value-bind + (temporary-variables initforms newvals setter getter) + (get-setf-expansion place env) + (when (cdr newvals) + (error "~A cannot store multiple values in one place" ',name)) + (with-unique-names (new-value key-val test-val alist entry) + (values + (append temporary-variables + (list alist + key-val + test-val + entry)) + (append initforms + (list getter + key + test + `(,',get-entry ,key-val ,alist :test ,test-val))) + `(,new-value) + `(cond + (,entry + (setf (,',get-value-from-entry ,entry) ,new-value)) + (t + (let ,newvals + (setf ,(first newvals) (,',add ,key ,new-value ,alist)) + ,setter + ,new-value))) + `(,',get-value-from-entry ,entry)))))))) (define-alist-get assoc-value assoc cdr acons "ASSOC-VALUE is an alist accessor very much like ASSOC, but it can be used with SETF.") @@ -103,11 +112,11 @@ "Modify-macro for NCONC. Concatenates LISTS to place designated by the first argument.") -(define-modify-macro unionf (list) union +(define-modify-macro unionf (list &rest args) union "Modify-macro for UNION. Saves the union of LIST and the contents of the place designated by the first argument to the designated place.") -(define-modify-macro nunionf (list) nunion +(define-modify-macro nunionf (list &rest args) nunion "Modify-macro for NUNION. Saves the union of LIST and the contents of the place designated by the first argument to the designated place. May modify either argument.") diff -Nru cl-alexandria-0.0.20091125/macros.lisp cl-alexandria-0.0.20100217/macros.lisp --- cl-alexandria-0.0.20091125/macros.lisp 2009-12-31 14:32:07.000000000 +0000 +++ cl-alexandria-0.0.20100217/macros.lisp 2010-03-08 16:30:12.000000000 +0000 @@ -199,7 +199,7 @@ (check-variable elt "keyword parameter") (setf elt (if normalize-keyword (list (list (make-keyword elt) elt) nil nil) - (list elt))))) + elt)))) (push elt keys)) (&aux (if (consp elt) diff -Nru cl-alexandria-0.0.20091125/tests.lisp cl-alexandria-0.0.20100217/tests.lisp --- cl-alexandria-0.0.20091125/tests.lisp 2009-12-31 14:32:07.000000000 +0000 +++ cl-alexandria-0.0.20100217/tests.lisp 2010-03-08 16:30:12.000000000 +0000 @@ -806,6 +806,34 @@ (mappend (compose 'list '*) '(1 2 3) '(1 2 3)) (1 4 9)) +(deftest assoc-value.1 + (let ((key1 '(complex key)) + (key2 'simple-key) + (alist '()) + (result '())) + (push 1 (assoc-value alist key1 :test #'equal)) + (push 2 (assoc-value alist key1 :test 'equal)) + (push 42 (assoc-value alist key2)) + (push 43 (assoc-value alist key2 :test 'eq)) + (push (assoc-value alist key1 :test #'equal) result) + (push (assoc-value alist key2) result) + + (push 'very (rassoc-value alist (list 2 1) :test #'equal)) + (push (cons 'very (cdr (assoc '(very complex key) alist :test #'equal))) result) + (reverse result)) + ((2 1) (43 42) (very 2 1))) + +(deftest assoc-value.2 + (let ((key 'key) + (alist '()) + (result '())) + (setf (assoc-value alist key) 1) + (push (assoc-value alist key) result) + (push (setf (assoc-value alist key) 2) result) + (push (assoc-value alist key) result) + (reverse result)) + (1 2 2)) + ;;;; Numbers (deftest clamp.1