anchor.diff:       (- (+ (length (buffer queue)) (head-index queue))
           (tail-index queue)))))
   
  -(defmethod call-for-all-elements ((queue queue) callback)
  +(defmethod call-for-all-elements-with-index ((queue queue) callback)
     "Calls CALLBACK passing it each element in QUEUE. The elements
   will be called in the same order thah DEQUEUE would return them."
     (flet ((callback (index)
  -           (funcall callback (aref (buffer queue) index))))
  +           (funcall callback (aref (buffer queue) index) index)))
       (if (< (head-index queue) (tail-index queue))
           ;; growing from the bottom. conceptualy the new elements need
           ;; to go between tail and head. it's simpler to just move them
  
positive.code:   (when (queue-full-p queue)
      (dequeue queue))
    (call-next-method queue value))
  
negative.code:            for index from (tail-index queue) below (head-index queue)
             do (callback index)))))
  
  (defmacro do-all-elements ((element queue &optional index) &body body)
    (if index
        `(call-for-all-elements-with-index ,queue
                                           (lambda (,element ,index)
                                             ,@body))
        (let ((index (gensym "do-all-elements-index-")))
          `(call-for-all-elements ,queue
                                  (lambda (,element ,index)
                                    (declare (ignore ,index))
                                    ,@body)))))
  
  (defmethod grow-queue ((queue queue))
    (let ((new-buffer (make-array (* (length (buffer queue)) 2)
                                  :element-type (array-element-type (buffer queue)))))
      (let ((index 0))
        (do-all-elements (element queue)
          (setf (aref new-buffer index) element)
          (incf index))
        (setf (head-index queue) index
              (tail-index queue) 0
              (buffer queue) new-buffer))
  