Class K-Best-Heap-Container

Stores the k best values where best is defined by sorter. This
means that the item at the top of the heap is the worst item. So if you want the best
items to be the largest items, make sure sorter is '<'.

Part of:

package metabang.cl-containers, class heap-container, class bounded-container-mixin

Default initargs

:sorter → #:k → #
:initial-size → #

Direct Superclass

bounded-container-mixin
heap-container

Slot

contentsReader:contents.
element-typeInitargs::element-type; Reader:element-type.
kInitform:1, Initargs::k; Accessors:k-best-number.
keyInitform:(quote identity), Initargs::key; Reader:key.
sorterInitform:(function <), Initargs::sorter; Accessors:sorter.
testInitform:(function equal), Initargs::test.

Direct Method

insert-item

Adds item to the container

Other Method

%operate-after-finding
add-initial-contents
base-class-for-iteratee
best-item

Returns the item in items with the 'best' value of function where
'best' is determined by test. Y...

biggest-item
collect-elements

Returns a possibly filtered and possibly transformed list of the elements in a container. If the ...

collect-elements-stably
collect-nodes

Returns a possibly filtered and possibly transformed list
of the nodes in a container. If the con...

count-elements
count-elements-if
count-items
delete-biggest-item
delete-element
delete-first

Removes (and returns) the first item in an ordered
container.
Behavior is undefined if the conta...

delete-item
delete-item-at
delete-item-if
delete-last

Removes (and returns) the last item in an ordered
container.
Behavior is undefined if the contai...

delete-list

Deletes each item in the list from the container.

element-position

Returns the position of element in container using test and
key to match. Key defaults to identit...

empty!

Removes all items from the container and returns nil.

every-element-p
every-item-p

Returns true if every item in the container satisfies the
predicate. Predicate should be a funct...

exchange-heap-nodes
find-element

For now, compare find-item.

find-item

Find item in container using the container's test
method for comparisons. The test method must ta...

first-element
heap-node-parent
heapify
insert-initial-contents-p

Returns true if this container type should rely on the default behavior of basic-initial-contents...

insert-item-at

Inserts item at the specified index, increasing the index of all following elements

insert-list

Adds each item in the list to the container in an
upspecified order.

insert-new-item

Adds item to the container unless it is already there

insert-sequence

Adds each item in the sequence to the container in an
upspecified order.

item-at

Returns the item specified by the indexes.

item-at!

[Destructively] modifies the item specified by the
indexes to the value.

iteratable-p

Returns true if thing knows how to iterate-nodes.

iterate-elements
iterate-nodes

Applies function to each node in the container. If the container doesn't have nodes, then this is...

l-child
last-element
make-container-for-contents

Creates a sub-container to be used as contents for a
super-container.

make-node-for-container
nth-element

Returns the nth element in the container's 'natural' order.

predecessor

Return the item that comes before item in the container. Only makes sense for sorted containers...

print-container

Prints the contents of container (using PRINT). Returns the container.

r-child
reduce-container
reduce-elements
reduce-nodes
remove-items-if

Removes items from a container that satisfy the test. The
container is returned.

reverse-container

Destructively alters the elements/nodes of an ordered container so that they are reversed.

samep

Compares two things and returns true if they are the same
in the sense of being interchangable. I...

search-for-element
search-for-item

Hunt for the item in the container. Key and Test
are as in member.

search-for-match

Hunt for an item in the container that satisfies
the predicate. Key is as in count-if.

search-for-matching-node
search-for-node
search-for-node*
setffirst-element
setflast-element
size

Returns the number of items currently in the container.

some-element-p
some-item-p

Returns the first item in the container for which predicate
holds. Predicate should be a function...

sort-container
successor

Return the item that comes after item in the container. Only makes sense for sorted containers. R...

total-size
unique-elements
unique-nodes