yah
2026-01-01
Yet Another Heap
Upstream URL
Author
License
YAH - Yet Another Heap
Table of Contents
[in package YAH]
-
[system] "yah"
- Version: 0.0.1
- Description: Yet Another Heap
- Licence: BSD-3
- Author: Thomas Bartscher thomas-bartscher@weltraumschlangen.de
- Depends on: mgl-pax
1 Reference
- [class] FINGER
- [class] HEAP
-
[function] MAKE-HEAP PREDICATE
Makes a heap sorting by predicate
PREDICATE. This means that if there are two values with keys A and B on the heap, if(funcall predicate a b)is true, A will be popped off the heap before B.
-
[function] INSERT! HEAP KEY VALUE
Add
VALUEwith atKEYinto theHEAP. Returns a finger to the resulting entry in the heap.
-
[function] EXTRACT! HEAP
Pop the top element from the
HEAP, according to the heap's predicate. Returns two values: The value and the key of the popped element.Fails if
HEAPis empty.
-
[function] INSERT-EXTRACT! HEAP KEY VALUE
Insert
VALUEatKEYintoHEAP, then immediately pop the top element.
-
[function] EXTRACT-INSERT! HEAP KEY VALUE
First pop the top element of
HEAP, then insertVALUEatKEY. Returns two values: The value and the key of the popped element.Fails if
HEAPis empty.
-
[function] PEEK HEAP
Returns two values: The value and the key of the top element of the
HEAP.
-
[function] CHANGE-KEY! HEAP FINGER KEY
Changes the key of
FINGERinHEAPtoKEY.
-
[function] CHANGE-VALUE! FINGER VALUE
Changes the value of
FINGERtoVALUE.
-
[function] DELETE! HEAP FINGER
Remove
FINGERfromHEAP.
-
[function] EMPTY-HEAP? HEAP
Returns
TifHEAPis empty, andNILotherwise.
-
[macro] DO-HEAP (VAR HEAP &OPTIONAL RETURN-VALUE) &BODY BODY
Execute the body with
VARbound to the result of (EXTRACT!HEAP) untilHEAP~ is empty. Finally returnRETURN-VALUE