 
 <PRIVATE
 
+! called bubble-up in the litterature... but we keep pypy's name.
 :: sift-down ( heap from to -- )
     heap data>>      :> data
     to data data-nth :> tmp


<PRIVATE

:: sift-up ( heap n -- )
    heap data>>     :> data
    data length     :> end

sequences.private summary vectors ;
IN: heaps

! names and optimizations copied from pypy's heapq.py,
! refer to it from in depth explanations of the optimizations.

GENERIC: heap-push* ( value key heap -- entry )
GENERIC: heap-peek ( heap -- value key )
GENERIC: heap-pop* ( heap -- )
