anchor.diff:      (setf (aref elements index) new)
       (if (funcall compare-fn new old)
           (heap-improve-key elements hash index compare-fn)
  -        (heapify elements hash index compare-fn))))
  +        (heapify elements hash index compare-fn)))
  +  q)
   
   (defun queue-update (q item)
     "queue-update makes sure that item is sorted correctly in q. Call
   queue-update after changing item in such a way that would affect its
  -priority."
  +priority. Returns the queue."
     (let ((compare-fn (q-compare-fn q))
           (elements (q-elements q))
           (hash (q-item-index q))
  
positive.code: (in-package #:priority-queue)
  
  ;; For queue-replace to work, the items stored in the queue must be
  ;; unique when tested by 'eql.
  
  (defstruct q
    (compare-fn nil :type function)
  
negative.code:     (if (and (> index 0)
               (funcall compare-fn item (aref elements (heap-parent index))))
          (heap-improve-key elements hash index compare-fn)
          (heapify elements hash index compare-fn)))
    q)
  
  (defun queue-delete (q item)
    "Delete item from the queue. Returns the queue."
    (let* ((hash (q-item-index q))
           (index (gethash item hash)))
      (assert index nil "index for item ~A not found in hash" item)
      (heap-delete (q-elements q) hash index (q-compare-fn q)))
    q)
  
  ;;;; The Heap Implementation of Priority Queues
  
  