Handbook
Glossary
sift-down ( value prio left right -- heap )
Vocabulary
persistent
.
heaps
.
private
Inputs
value
an
object
prio
an
object
left
an
object
right
an
object
Outputs
heap
an
object
Definition
IN:
persistent.heaps.private
GENERIC:
sift-down
( value prio left right -- heap )
Methods
USING:
accessors
kernel
math
persistent.heaps.private
;
M:
branch
sift-down
[
[
prio>>
<=
]
both-with?
]
3check
[
<branch>
]
[
[
[
prio>>
]
bi@
<=
]
2check
[
reroot-left
]
[
reroot-right
]
if
]
if
;
USING:
kernel
persistent.heaps.private
;
M:
empty-heap
sift-down
over
singleton-heap?
[
singleton-sift-down
]
[
<branch>
]
if
;