Previous: binary heaps iterthunks, Up: binary heaps [Index]
The following bindings are exported by the library (vicare
containers binary-heaps)
. The bindings whose name is prefixed with
$
are unsafe operations: they do not validate their
arguments before accessing them.
Build and return a new instance of <binary-heap>
using the same
comparison predicate of heap and containing the same objects of
heap.
While the heap is not empty: apply kons to knil and the next top object; the return value of the application becomes the new knil; return the return value of the last application. After a call to this function: the heap is left empty.
(binary-heap-fold! (lambda (knil obj) (cons obj knil)) '() (fold-left (lambda (heap obj) (binary-heap-push! heap obj) heap) (make-binary-heap <) '(2 4 0 1 3))) ⇒ (4 3 2 1 0)
Build and return a new instance of <binary-heap>
using the same
comparison predicate of heap1 and containing the same objects of
both heap1 and heap2. The arguments heap1 and
heap2 are left unchanged.
Destructively extract all the objects from heap2 and add them to heap1. Return heap1 itself.