sift-down ( heap from to -- )


Vocabulary
heaps.private

Inputs
heapan object
froman object
toan object


Outputs
None

Definition


:: sift-down ( heap from to -- )
heap data>> :> data to data data-nth :> tmp to t
[ over from > and ] [
dup up dup data data-nth dup tmp heap heap-compare
[ rot data data-set-nth t ] [ 2drop f ] if
] while tmp swap data data-set-nth ; inline