anchor.diff:                                  (aref vector parent) child-data
                                   child parent))))))
       ;; Clean again
  -    (setf (heap-dirty heap) nil)
  +    (setf (heap-state heap) :clean)
       victim))
   
   (defun heap-delete (elt heap)
     "If ELT is in HEAP, removes it. Returns T if one or more references to ELT
  -were found and removed, NIL otherwise"
  +were found and removed, NIL otherwise.
  +
  +Implicitly locks the heap during its operation."
     (declare (type heap heap))
     (with-locked-heap (heap)
  -    (when (heap-dirty heap)
  -      (error "Heap dirty on entry to HEAP-DELETE."))
  +    (check-heap-clean heap 'heap-delete)
       (let* ((count (heap-count heap))
              (vector (heap-vector heap))
              (pred (heap-predicate heap)))
  
positive.code:                                                         (setf (aref vector 0) +empty+)
                                                          vector))))
               (:copier nil))
    "A binary heap."
    ;; One longer than SIZE: we keep the min element in both 0 and 1. Using
    ;; 1-based addressing makes heap calculations simpler, and keeping a
    ;; separate reference in 0 allows HEAP-MIN to be lockless.
  
negative.code: 
  (defconstant max-heap-size (- heap-size-limit 1))
  
  (defun check-heap-clean (heap what &optional allow-traverse)
    (ecase (heap-state heap)
      (:clean t)
      (:dirty
       (error "Heap dirty on entry to ~S: ~S"
              what heap))
      (:traverse
       (unless allow-traverse
         (error "Cannot ~S while ~S is in progress: ~S"
                what 'map-heap heap)))))
  
  (defun heap-insert (elt heap)
    "Insert ELT to HEAP. Returns ELT.
  
  Implicitly locks the heap during its operation."
    (declare (heap heap))
    (with-locked-heap (heap)
      (check-heap-clean heap 'heap-insert)
      (let* ((vector (heap-vector heap))
             (pred (heap-predicate heap))
             (size (heap-size heap))
  