(10 . "October")
(11 . "November")
(12 . "December")))
-
+
(defun monthname (stream arg colon-p at-p &optional width (mincol 0) (colinc 1) (minpad 0) (padchar #\Space))
"Print the name of the month (1=January) corresponding to ARG on STREAM. This is intended for embedding in a FORMAT directive: WIDTH governs the number of characters of text printed, MINCOL, COLINC, MINPAD, PADCHAR work as for ~A"
(let ((monthstring (cdr (assoc arg *monthnames*))))
(setf ,plist (append ,plist (list ,pkey ,value)))))))
+(defun unique-slot-values (list slot &key (test 'eql))
+ (let ((uniq '()))
+ (dolist (item list (nreverse uniq))
+ (let ((value (slot-value item slot)))
+ (unless (find value uniq :test test)
+ (push value uniq))))))
+
#:update-plist
#:get-plist
#:flatten
-
+ #:unique-slot-values
+
;; seq.lisp
#:nsubseq
(make-url "pg" :anchor "then" :vars '(("a" . "5") ("b" . "pi")))
"pg?a=5&b=pi#then")
+(defclass test-unique ()
+ ((a :initarg :a)
+ (b :initarg :b)))
+
+
+(deftest :unique.1
+ (let ((list (list (make-instance 'test-unique :a 1 :b 1)
+ (make-instance 'test-unique :a 2 :b 2)
+ (make-instance 'test-unique :a 3 :b 2))))
+ (values
+ (unique-slot-values list 'a)
+ (unique-slot-values list 'b)))
+ (1 2 3) (1 2))
+
+(deftest :unique.2
+ (unique-slot-values nil 'a)
+ nil)
+
+
;;; MOP Testing
;; Disable attrib class until understand changes in sbcl/cmucl