- "The default name for anonymous `collecting' lists.")
- (defun make-collector ()
- (let ((head (cons nil nil)))
- (setf (car head) head))))
+ "The default name for anonymous `collecting' lists."))
+
+(defun make-collector (&optional list)
+ "Return a new collector object whose initial contents is LIST. Note that
+ LIST will be destroyed if anything else is collected."
+ (let ((head (cons nil list)))
+ (setf (car head) (if list (last list) head))))
+
+(defmacro collected (&optional (name *collecting-anon-list-name*))
+ "Return the current list collected into the collector NAME (or
+ *collecting-anon-list-name* by default)."
+ `(the list (cdr ,name)))