(defun is-in-heap (item heap)
(with-comparator (heap-comparator heap)
(loop for i below (heap-size heap)
for elem across (heap-array heap)
with key-fn = (heap-key-fn heap)
when (comp-= (funcall key-fn elem)
(funcall key-fn item))
do (return t)
finally (return nil))))Source Context