Function: HEAP-DEQUEUE

Source

(defun heap-dequeue (heap)
  (unless (heap-empty-p heap)
    (let ((save (heap-front heap)))
      (setf (aref (heap-array heap) 0)
	    (aref (heap-array heap) (decf (heap-size heap))))
      ;;allow removed for begin garbage collected
      (setf (aref (heap-array heap) (heap-size heap)) 0)
      (heapify (heap-array heap) 0 (heap-size heap) (heap-key-fn heap)
		 (heap-comparator heap))
      save)))
Source Context