Persistent collections inherit from Class elephant:persistent-collection and consist of the Class elephant:btree, Class elephant:indexed-btree and Class elephant:btree-index classes. The following operations are defined on most of these classes. More information can be found in Persistent BTrees and BTree Indexing.
Values are written to a btree using the
setf method on
Remove a key / value from the
primaryby a secondary lookup, updating
allother secondary indices.
Map btree maps over a btree from the value start to the value of end. If values are not provided, then it maps over all values. BTrees do not have duplicates, but map-btree can also be used with indices in the case where you don't want access to the primary key so we require a value argument as well for mapping duplicate value sets. The collect keyword will accumulate the results from each call of fn in a fresh list and return that list in the same order the calls were made (first to last).
These functions are only defined on indexed btrees.
Add a secondary index. The indices are stored in an eq hash-table, so the index-name should be a symbol. key-form should be a symbol naming a function, a function call form eg '(create-index 3) or a lambda expression
--actual functions aren't supported. Lambda expresssions are converted to functions through compile and function call forms are transformed applying the first element of the list to the rest of the list. The function should take 3 arguments: the secondary
db, primary key and value, and return two values: a boolean indicating whether to index this key / value, and the secondary key if so. If populate = t it will fill in secondary keys for existing primary entries (may be expensive!)
This function is only valid for indexes.
Map-index is like map-btree but for secondary indices, it takes a function of three arguments: key, value and primary key. As with map-btree the keyword arguments start and end determine the starting element and ending element, inclusive. Also, start = nil implies the first element, end = nil implies the last element in the index. If you want to traverse only a set of identical key values, for example all nil values, then use the value keyword which will override any values of start and end. The collect keyword will accumulate the results from each call of fn in a fresh list and return that list in the same order the calls were made (first to last)