The cl-trie Reference Manual

This is the cl-trie Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 15:48:24 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 cl-trie

Common Lisp implementation of Trie data structure.

Author

Mateusz Malisz <>

License

MIT

Source

cl-trie.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 cl-trie/cl-trie.asd

Source

cl-trie.asd.

Parent Component

cl-trie (system).

ASDF Systems

cl-trie.


3.1.2 cl-trie/package.lisp

Source

cl-trie.asd.

Parent Component

cl-trie (system).

Packages

cl-trie.


3.1.3 cl-trie/generics.lisp

Dependency

package.lisp (file).

Source

cl-trie.asd.

Parent Component

cl-trie (system).

Public Interface
Internals

attach (generic function).


3.1.4 cl-trie/basic-trie.lisp

Dependency

generics.lisp (file).

Source

cl-trie.asd.

Parent Component

cl-trie (system).

Public Interface
Internals

basic-trie (class).


3.1.5 cl-trie/trie.lisp

Dependency

basic-trie.lisp (file).

Source

cl-trie.asd.

Parent Component

cl-trie (system).

Public Interface

4 Packages

Packages are listed by definition order.


4.1 cl-trie

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Ordinary functions

Function: hash-table->trie (hash-map)

Convert hash-table to a trie.

Package

cl-trie.

Source

trie.lisp.


5.1.2 Generic functions

Generic Reader: activep (object)
Generic Writer: (setf activep) (object)
Package

cl-trie.

Methods
Reader Method: activep ((trie trie))
Writer Method: (setf activep) ((trie trie))

A flag that tells whether a node is active and value is of interest, or is inactive and value can be ignored.

Source

trie.lisp.

Target Slot

%activep.

Generic Function: all-keys (trie)

Return list of all keys of TRIE.

Package

cl-trie.

Source

generics.lisp.

Methods
Method: all-keys ((trie trie))
Source

trie.lisp.

Generic Function: all-values (trie)

Return list of all values of TRIE.

Package

cl-trie.

Source

generics.lisp.

Methods
Method: all-values ((trie trie))
Source

trie.lisp.

Generic Reader: children (object)
Generic Writer: (setf children) (object)
Package

cl-trie.

Methods
Reader Method: children ((basic-trie basic-trie))
Writer Method: (setf children) ((basic-trie basic-trie))

Children nodes of the trie.

Source

basic-trie.lisp.

Target Slot

%children.

Generic Function: clear (trie)

Clear TRIE of its contents, leaving it empty.

Package

cl-trie.

Source

generics.lisp.

Methods
Method: clear ((trie trie))
Source

trie.lisp.

Generic Function: emptyp (trie)

Return T if TRIE is empty, otherwise NIL.

Package

cl-trie.

Source

generics.lisp.

Methods
Method: emptyp ((trie trie))
Source

trie.lisp.

Generic Function: find-node (trie index &key create-new)

Find node under INDEX in TRIE, or return NIL if no node has been found. If CREATE-NEW is T, all the nodes, including the searched one, will be created if they do not exist, effectively creating the node at index.

Package

cl-trie.

Source

generics.lisp.

Methods
Method: find-node ((trie trie) (index string) &key create-new)
Source

trie.lisp.

Generic Function: insert (elem trie index)

Insert ELEM as value of item at INDEX in TRIE to NEW-VALUE. Alias to (setf lookup).

Package

cl-trie.

Source

generics.lisp.

Methods
Method: insert (elem (trie trie) (index string))
Source

trie.lisp.

Generic Reader: key (object)
Package

cl-trie.

Methods
Reader Method: key ((basic-trie basic-trie))

A part of the sequence, that indicates that this node represents a sequence of all keys from the root up to this node, including this node.

Source

basic-trie.lisp.

Target Slot

%key.

Generic Function: leafp (trie)

Return T if trie is a leaf (has no children), NIL otherwise.

Package

cl-trie.

Source

generics.lisp.

Methods
Method: leafp ((trie trie))
Source

trie.lisp.

Generic Function: lookup (trie index &optional default)

Check if there is something at INDEX in TRIE.
Return two values, the first one being value at TRIE, and second one being
T if anything was found at index and NIL if not.
If DEFAULT is provided, in case nothing is found, DEFAULT will be returned as the first value.

Package

cl-trie.

Source

generics.lisp.

Methods
Method: lookup ((trie trie) (index string) &optional default)
Source

trie.lisp.

Generic Function: (setf lookup) (trie index)

Set value of item at INDEX in TRIE to NEW-VALUE. Return the node that will hold the value.

Package

cl-trie.

Source

generics.lisp.

Methods
Method: (setf lookup) ((trie trie) (index string))
Source

trie.lisp.

Generic Function: mapkeys (fn trie)

Apply function FN to each key in TRIE. Returns TRIE.

Package

cl-trie.

Source

generics.lisp.

Methods
Method: mapkeys ((fn function) (trie trie))
Source

trie.lisp.

Generic Function: mapvalues (fn trie)

Apply function FN to each value in TRIE. Returns TRIE.

Package

cl-trie.

Source

generics.lisp.

Methods
Method: mapvalues ((fn function) (trie trie))
Source

trie.lisp.

Generic Function: remove-index (trie index)

Remove INDEX entry from TRIE. Return TRIE.

Package

cl-trie.

Source

generics.lisp.

Methods
Method: remove-index ((trie trie) (index string))
Source

trie.lisp.

Generic Function: remove-node (node &key preserve-value)

Deactivate NODE, removing the value unless preserve-value is non-nil. Return NODE.

Package

cl-trie.

Source

generics.lisp.

Methods
Method: remove-node ((node trie) &key preserve-value)
Source

trie.lisp.

Generic Function: size (trie)

Return size of TRIE, where size is number of elements found in the trie.

Package

cl-trie.

Source

generics.lisp.

Methods
Method: size (trie)
Source

trie.lisp.

Generic Reader: value (object)
Package

cl-trie.

Methods
Reader Method: value ((basic-trie basic-trie))

automatically generated reader method

Source

basic-trie.lisp.

Target Slot

%value.

Generic Function: (setf value) (object)
Package

cl-trie.

Methods
Method: (setf value) :after ((trie trie))
Source

trie.lisp.

Writer Method: (setf value) ((basic-trie basic-trie))

automatically generated writer method

Source

basic-trie.lisp.

Target Slot

%value.


5.1.3 Standalone methods

Method: initialize-instance :after ((instance trie) &key value activep)
Source

trie.lisp.

Method: initialize-instance :around ((instance trie) &key key verbose)
Source

trie.lisp.


5.1.4 Conditions

Condition: empty-key-warning

A warning emitted when key for trie is not provided.

Package

cl-trie.

Source

generics.lisp.

Direct superclasses

warning.

Condition: wrong-key-type-error

An error emitted when key is of a wrong type.

Package

cl-trie.

Source

generics.lisp.

Direct superclasses

error.


5.1.5 Classes

Class: trie

A lexicographically sorted trie.

Package

cl-trie.

Source

trie.lisp.

Direct superclasses

basic-trie.

Direct methods
Direct Default Initargs
InitargValue
:childrennil
:verboset
Direct slots
Slot: %activep

A flag that tells whether a node is active and value is of interest, or is inactive and value can be ignored.

Type

boolean

Initargs

:activep

Readers

activep.

Writers

(setf activep).


5.2 Internals


5.2.1 Generic functions

Generic Function: attach (parent-trie children-trie &key on-conflict)

Attach CHILDREN-TRIE to PARENT-TRIE.
If conflict happens (attached trie has the same key as already existing branch), ON-CONFLICT describes the chosen strategy.
Possible options:
NIL - do nothing
:merge - try to merge tries
:error - raise an error

Package

cl-trie.

Source

generics.lisp.


5.2.2 Classes

Class: basic-trie
Package

cl-trie.

Source

basic-trie.lisp.

Direct subclasses

trie.

Direct methods
Direct slots
Slot: %children

Children nodes of the trie.

Type

list

Initargs

:children

Readers

children.

Writers

(setf children).

Slot: %key

A part of the sequence, that indicates that this node represents a sequence of all keys from the root up to this node, including this node.

Initform

(warn (quote cl-trie:empty-key-warning))

Initargs

:key

Readers

key.

Writers

This slot is read-only.

Slot: %value
Initargs

:value

Readers

value.

Writers

(setf value).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   C   E   F   G   H   I   K   L   M   R   S   V  
Index Entry  Section

(
(setf activep): Public generic functions
(setf activep): Public generic functions
(setf children): Public generic functions
(setf children): Public generic functions
(setf lookup): Public generic functions
(setf lookup): Public generic functions
(setf value): Public generic functions
(setf value): Public generic functions
(setf value): Public generic functions

A
activep: Public generic functions
activep: Public generic functions
all-keys: Public generic functions
all-keys: Public generic functions
all-values: Public generic functions
all-values: Public generic functions
attach: Private generic functions

C
children: Public generic functions
children: Public generic functions
clear: Public generic functions
clear: Public generic functions

E
emptyp: Public generic functions
emptyp: Public generic functions

F
find-node: Public generic functions
find-node: Public generic functions
Function, hash-table->trie: Public ordinary functions

G
Generic Function, (setf activep): Public generic functions
Generic Function, (setf children): Public generic functions
Generic Function, (setf lookup): Public generic functions
Generic Function, (setf value): Public generic functions
Generic Function, activep: Public generic functions
Generic Function, all-keys: Public generic functions
Generic Function, all-values: Public generic functions
Generic Function, attach: Private generic functions
Generic Function, children: Public generic functions
Generic Function, clear: Public generic functions
Generic Function, emptyp: Public generic functions
Generic Function, find-node: Public generic functions
Generic Function, insert: Public generic functions
Generic Function, key: Public generic functions
Generic Function, leafp: Public generic functions
Generic Function, lookup: Public generic functions
Generic Function, mapkeys: Public generic functions
Generic Function, mapvalues: Public generic functions
Generic Function, remove-index: Public generic functions
Generic Function, remove-node: Public generic functions
Generic Function, size: Public generic functions
Generic Function, value: Public generic functions

H
hash-table->trie: Public ordinary functions

I
initialize-instance: Public standalone methods
initialize-instance: Public standalone methods
insert: Public generic functions
insert: Public generic functions

K
key: Public generic functions
key: Public generic functions

L
leafp: Public generic functions
leafp: Public generic functions
lookup: Public generic functions
lookup: Public generic functions

M
mapkeys: Public generic functions
mapkeys: Public generic functions
mapvalues: Public generic functions
mapvalues: Public generic functions
Method, (setf activep): Public generic functions
Method, (setf children): Public generic functions
Method, (setf lookup): Public generic functions
Method, (setf value): Public generic functions
Method, (setf value): Public generic functions
Method, activep: Public generic functions
Method, all-keys: Public generic functions
Method, all-values: Public generic functions
Method, children: Public generic functions
Method, clear: Public generic functions
Method, emptyp: Public generic functions
Method, find-node: Public generic functions
Method, initialize-instance: Public standalone methods
Method, initialize-instance: Public standalone methods
Method, insert: Public generic functions
Method, key: Public generic functions
Method, leafp: Public generic functions
Method, lookup: Public generic functions
Method, mapkeys: Public generic functions
Method, mapvalues: Public generic functions
Method, remove-index: Public generic functions
Method, remove-node: Public generic functions
Method, size: Public generic functions
Method, value: Public generic functions

R
remove-index: Public generic functions
remove-index: Public generic functions
remove-node: Public generic functions
remove-node: Public generic functions

S
size: Public generic functions
size: Public generic functions

V
value: Public generic functions
value: Public generic functions