Next: , Up: binary heaps   [Index]

39.1 Heap objects

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.

R6RS Record Type: <binary-heap>

Record type representing a binary heap object. The <binary-heap> type is non–generative and available for subtyping. In this documentation <binary-heap> object arguments to functions are indicated as heap.

Function: make-binary-heap item<
Function: make-binary-heap item< initial-array-size

Build and return a new instance of <binary-heap>. item< must be a procedure implementing a “less than” comparison predicate. The optional initial-array-size must be a non–negative fixnum representing the initial size of the underlying vector used as storage for the heap implementation.

Function: binary-heap? obj

Return #t if obj is a record of type <binary-heap>; otherwise return #f.

Object properties

Function: binary-heap-putprop heap key value
Function: $binary-heap-putprop heap key value

Add a new property key to the property list of heap; key must be a symbol. If key is already set: the old entry is mutated to reference the new value.

Function: binary-heap-getprop heap key
Function: $binary-heap-getprop heap key

Return the value of the property key in the property list of heap; if key is not set: return #f. key must be a symbol.

Function: binary-heap-remprop heap key
Function: $binary-heap-remprop heap key

Remove the property key from the property list of heap; if key is not set: nothing happens. key must be a symbol.

Function: binary-heap-property-list heap
Function: $binary-heap-property-list heap

Return a new association list representing the property list of heap. The order of the entries is the same as the property creation order.

Other operations

Function: binary-heap-hash heap
Function: $binary-heap-hash heap

Return an exact integer to be used as hashtable key for heap. Hashtables having a <binary-heap> as key can be instantiated as follows:

(make-hashtable binary-heap-hash eq?)

Next: , Up: binary heaps   [Index]