# FUNCTION

# Public

# HEAP-CLEAR (HEAP)

Remove all elements from the heap, leaving it empty. Faster
(& more convenient) than calling HEAP-REMOVE until the heap is
empty.

# HEAP-EMPTY-P (HEAP)

Returns non-NIL if & only if the heap contains no items.

# HEAP-INSERT (HEAP X)

Insert a new element into the heap. Return the element (which probably
isn't very useful).

# HEAP-PEEK (HEAP)

Return the first element in the heap, but don't remove it. It'll
be an error if the heap is empty. (Should that be an error?)

# HEAP-REMOVE (HEAP &OPTIONAL (FN #'DEFAULT-SEARCH-PREDICATE))

Remove the minimum (first) element in the heap & return it. It's
an error if the heap is already empty. (Should that be an error?)

# Undocumented

# CREATE-HEAP (LESS-FN &KEY (ORDER 2) (INITIAL-CONTENTS NIL))

# HEAP-COLLECT (HEAP &OPTIONAL (FN #'DEFAULT-SEARCH-PREDICATE))

# HEAP-COUNT (HEAP)

# HEAP-FIND (HEAP &OPTIONAL (FN #'DEFAULT-SEARCH-PREDICATE))

# Private

# HEAP-A (INSTANCE)

@arg[extid]{A @class{extid}}
@return[sytemid]{puri:uri or nil}
Returns the System ID part of this External ID.

# HEAP-FIND-IDX (HEAP FNP)

Return the index of the element which satisfies the predicate FNP.
If there is no such element, return the fill pointer of HEAP's array A.

# HEAP-INIT (HEAP LESS-FN &KEY (ORDER 2) (INITIAL-CONTENTS NIL))

Initialize the indicated heap. If INITIAL-CONTENTS is a non-empty
list, the heap's contents are intiailized to the values in that
list; they are ordered according to LESS-FN. INITIAL-CONTENTS must
be a list or NIL.

# HEAP-LESS-FN (INSTANCE)

@arg[extid]{A @class{extid}}
@return[sytemid]{puri:uri or nil}
Returns the System ID part of this External ID.

# HEAP-MAX-COUNT (INSTANCE)

@arg[extid]{A @class{extid}}
@return[sytemid]{puri:uri or nil}
Returns the System ID part of this External ID.

# HEAP-ORDER (INSTANCE)

# LESSER-CHILD (HEAP PARENT)

Return the index of the lesser child. If there's one child,
return its index. If there are no children, return
(FILL-POINTER (HEAP-A HEAP)).

# PERCOLATE-DOWN (HEAP HOLE X)

Private. Move the HOLE down until it's in a location suitable for X.
Return the new index of the hole.

# PERCOLATE-UP (HEAP HOLE X)

Private. Moves the HOLE until it's in a location suitable for holding
X. Does not actually bind X to the HOLE. Returns the new
index of the HOLE. The hole itself percolates down; it's the X
that percolates up.