Handbook
Glossary
pheap-push ( value prio heap -- newheap )
Persistent heaps
Prev:
pheap-peek ( heap -- value prio )
Next:
pheap-pop ( heap -- newheap value prio )
Vocabulary
persistent
.
heaps
Inputs
value
an
object
prio
a priority
heap
a persistent heap
Outputs
newheap
a new persistent heap
Word description
Creates a new persistent heap also containing the given object of the given priority.
Definition
IN:
persistent.heaps
GENERIC:
pheap-push
( value prio heap -- newheap )
Methods
USING:
accessors
kernel
math
persistent.heaps
persistent.heaps.private
;
M:
branch
pheap-push
[
prio>>
<=
]
2check
[
push-top
]
[
push-in
]
if
;
USING:
kernel
persistent.heaps
persistent.heaps.private
;
M:
empty-heap
pheap-push
drop
<singleton-heap>
;