This is the history-tree Reference Manual, version 0.1.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Mar 15 06:13:48 2023 GMT+0.
The main system appears first, followed by any subsystem dependency.
history-tree
Store the history of a browser’s visited paths.
Atlas Engineer LLC
BSD 3-Clause
0.1.1
alexandria
(system).
cl-custom-hash-table
(system).
local-time
(system).
nclasses
(system).
trivial-package-local-nicknames
(system).
package.lisp
(file).
history-tree.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
history-tree/history-tree.lisp
history-tree
(system).
add-child
(method).
add-children
(method).
add-entry
(function).
add-owner
(function).
all-branch-nodes
(method).
all-children
(method).
all-children
(method).
all-contiguous-owned-children
(method).
all-contiguous-owned-nodes
(method).
all-contiguous-owned-parents
(method).
all-data
(method).
all-forward-children
(method).
all-owner-nodes
(method).
all-parents
(method).
all-parents
(method).
backward
(method).
backward-owned-parents
(method).
bindings
(reader method).
(setf bindings)
(writer method).
children
(reader method).
(setf children)
(writer method).
creator-id
(reader method).
(setf creator-id)
(writer method).
current
(reader method).
(setf current)
(method).
current-binding
(function).
data
(reader method).
data
(method).
data
(reader method).
(setf data)
(writer method).
(setf data)
(writer method).
data-last-access
(function).
delete-data
(function).
delete-owner
(function).
do-tree
(macro).
entries
(reader method).
(setf entries)
(writer method).
entry
(reader method).
(setf entry)
(writer method).
entry
(class).
find-nodes
(function).
forward
(method).
go-to-child
(method).
go-to-owned-child
(method).
hash-function
(reader method).
(setf hash-function)
(writer method).
history-tree
(class).
key
(reader method).
(setf key)
(writer method).
last-access
(method).
last-access
(method).
last-access
(method).
last-access
(method).
(setf last-access)
(writer method).
(setf last-access)
(writer method).
make
(function).
map-owned-tree
(function).
map-tree
(function).
node
(class).
nodes
(reader method).
nodes
(reader method).
(setf nodes)
(writer method).
(setf nodes)
(writer method).
origin
(reader method).
(setf origin)
(writer method).
owned-children
(function).
owned-p
(function).
owned-parent
(function).
owned-root
(function).
owner
(function).
owner
(class).
owner-node
(function).
owners
(reader method).
(setf owners)
(writer method).
parent
(reader method).
(setf parent)
(writer method).
reset-owner
(function).
test
(reader method).
(setf test)
(writer method).
visit-all
(method).
binding
(class).
binding-p
(function).
branch-owners
(function).
contiguous-size
(method).
creator-node
(reader method).
(setf creator-node)
(writer method).
data-equal-entry-p
(function).
delete-disowned-branch-nodes
(function).
delete-node
(function).
depth
(function).
disown
(function).
disown-all
(function).
disowned-branch-nodes
(function).
disowned-p
(function).
ensure-timestamp
(function).
entry-equal-p
(function).
entry-hash
(function).
entry-p
(function).
export-always
(macro).
find-child
(function).
find-entry
(function).
find-node
(function).
find-owned-child
(function).
first-hash-table-key
(function).
first-hash-table-value
(function).
forward-child
(reader method).
(setf forward-child)
(writer method).
function-symbol
(type).
history
(reader method).
(setf history)
(writer method).
history-tree-p
(function).
make-entry
(function).
make-entry-hash-table
(function).
make-node
(function).
make-origin-node
(function).
map-data
(function).
node-contiguous-owned-parents
(function).
node-p
(function).
non-negative-integer
(type).
owned-children-lister
(function).
owner-p
(function).
positive-integer
(type).
root
(method).
size
(method).
size
(method).
visit
(method).
Packages are listed by definition order.
history-tree
htree
common-lisp
.
add-child
(generic function).
add-children
(generic function).
add-entry
(function).
add-owner
(function).
all-branch-nodes
(generic function).
all-children
(generic function).
all-contiguous-owned-children
(generic function).
all-contiguous-owned-nodes
(generic function).
all-contiguous-owned-parents
(generic function).
all-data
(generic function).
all-forward-children
(generic function).
all-owner-nodes
(generic function).
all-parents
(generic function).
backward
(generic function).
backward-owned-parents
(generic function).
bindings
(generic reader).
(setf bindings)
(generic writer).
children
(generic reader).
(setf children)
(generic writer).
creator-id
(generic reader).
(setf creator-id)
(generic writer).
current
(generic reader).
(setf current)
(generic function).
current-binding
(function).
data
(generic function).
(setf data)
(generic writer).
data-last-access
(function).
delete-data
(function).
delete-owner
(function).
do-tree
(macro).
entries
(generic reader).
(setf entries)
(generic writer).
entry
(generic reader).
(setf entry)
(generic writer).
entry
(class).
find-nodes
(function).
forward
(generic function).
go-to-child
(generic function).
go-to-owned-child
(generic function).
hash-function
(generic reader).
(setf hash-function)
(generic writer).
history-tree
(class).
key
(generic reader).
(setf key)
(generic writer).
last-access
(generic function).
(setf last-access)
(generic writer).
make
(function).
map-owned-tree
(function).
map-tree
(function).
node
(class).
nodes
(generic reader).
(setf nodes)
(generic writer).
origin
(generic reader).
(setf origin)
(generic writer).
owned-children
(function).
owned-p
(function).
owned-parent
(function).
owned-root
(function).
owner
(function).
owner
(class).
owner-node
(function).
owners
(generic reader).
(setf owners)
(generic writer).
parent
(generic reader).
(setf parent)
(generic writer).
reset-owner
(function).
test
(generic reader).
(setf test)
(generic writer).
visit-all
(generic function).
binding
(class).
binding-p
(function).
branch-owners
(function).
contiguous-size
(generic function).
creator-node
(generic reader).
(setf creator-node)
(generic writer).
data-equal-entry-p
(function).
delete-disowned-branch-nodes
(function).
delete-node
(function).
depth
(function).
disown
(function).
disown-all
(function).
disowned-branch-nodes
(function).
disowned-p
(function).
ensure-timestamp
(function).
entry-equal-p
(function).
entry-hash
(function).
entry-p
(function).
export-always
(macro).
find-child
(function).
find-entry
(function).
find-node
(function).
find-owned-child
(function).
first-hash-table-key
(function).
first-hash-table-value
(function).
forward-child
(generic reader).
(setf forward-child)
(generic writer).
function-symbol
(type).
history
(generic reader).
(setf history)
(generic writer).
history-tree-p
(function).
make-entry
(function).
make-entry-hash-table
(function).
make-node
(function).
make-origin-node
(function).
map-data
(function).
node-contiguous-owned-parents
(function).
node-p
(function).
non-negative-integer
(type).
owned-children-lister
(function).
owner-p
(function).
positive-integer
(type).
root
(generic function).
size
(generic function).
visit
(generic function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Apply actions in BODY to all the nodes in a tree.
Nodes are bound to VAR.
If TREE is a node, it’s passed right away,
if it is a tree, then the root is taken.
Always return nil, as it is an explicitly imperative macro.
Add DATA to an ‘entry’ in HISTORY ‘entries’.
If DATA is already there, don’t alter the entry.
Return the new or existing ‘entry’.
The higher-level functions take care of adding entries for you, so you normally
need not call this function. See ‘add-child’ instead.
One case in which this function might be useful is when you want to import flat
history data, e.g. a list of visited URLs that’s not bound to any owner.
Create and register owner object for OWNER-IDENTIFIER.
CREATOR-ID is the optional identifier of the parent owner.
DATA is the optional, arbitrary payload associated to the owner.
Return the newly created owner. If the owner with such identifier already
exists, return it and raise a warning.
Return data last access across all its nodes, regardless of the owner. Return Epoch if DATA is not found or if entry has no timestamp.
Delete entry matching DATA from HISTORY.
If nodes are still associated to entry, do nothing.
Delete ‘owner’ corresponding to OWNER-ID from HISTORY.
For every branch ‘owner’ has nodes on, remove all its nodes if the branch is
without any owner.
Return owner, or nil if there is no owner corresponding to OWNER-ID.
Return the nodes matching DATA.
Return a new ‘history-tree’.
Like ‘map-tree’ but restrict traversal to OWNER’s nodes. TREE is unused.
Map the FUNCTION over the TREE.
If TREE is a ‘htree:history-tree’, start from its OWNER root.
If TREE is a ‘htree:node’, start from it.
OWNER can be an ID or an ‘owner’ object.
Include results of applying FUNCTION over ROOT if INCLUDE-ROOT is
non-nil.
Return results as cons cells tree if FLATTEN is nil and as a flat
list otherwise.
COLLECT-FUNCTION is the function of two arguments that glues the
current node result to the result of further traversal.
Return the OWNER’s owned children for the current node.
Return OWNER’s parent if it’s owned, nil otherwise.
Return the first parent among the contiguous owned parents of NODE.
Return the ‘owner’ object identified by OWNER-SPEC in HISTORY. OWNER may be an owner ID or owner object.
Disown all OWNER’s nodes and create a new root node with the previous current node entry.
history-tree
) owner-spec) ¶Create or find a node holding DATA and set current node to it.
Return the (possibly new) current node.
Return NIL if OWNER-SPEC does not refer to an existing owner.
If current node matches DATA (which may be non-identical since the
‘history-tree”s ‘key’ and ‘test’ functions may identify two non-identical
pieces of data as equal), do nothing.
If DATA is found among the children, OWNER-SPEC current node ‘forward-child’ is
set to the matching child, the owner current node is set to this child.
If there is no current node, this creates the ‘origin’ node of OWNER-SPEC
and also sets ‘current’ to it. If the owner has a ‘creator-id’ set,
the new node is added to the children of the current node of the creator.
history-tree
) owner-spec) ¶Add CHILDREN-DATA to the HISTORY OWNER-SPEC current node.
Each child is added with ‘add-child’ to the current node.
If the owner does not have any node yet, then first element of CHILDREN-DATA
forms the new root, while the rest of the elements form the ‘children’ of this
root.
Return the (maybe new) current node, which holds the last piece of data in ‘children-data’.
history-tree
) owner-spec) ¶Return a list of all nodes that belong to the branch OWNER-SPEC node is on.
These nodes do not necessarily belong to OWNER-SPEC.
See ‘all-contiguous-owned-nodes’.
history-tree
) &key owner) ¶Return a list of all the children of HISTORY’s OWNER-SPEC current node. Children may not all be owned by OWNER-SPEC.
history-tree
) owner-spec &optional node) ¶Return a list of all the children of HISTORY’s OWNER-SPEC current node, recursively.
history-tree
) owner-spec) ¶Return a list of all nodes contiguous to OWNER-SPEC node, starting from the top-most parent, in depth-first order.
history-tree
) owner-spec) ¶Return a list of parents of owned by HISTORY OWNER-SPEC current node, recursively. First parent comes first in the resulting list.
history-tree
)) ¶Return a list of all entries data, in unspecified order.
history-tree
) owner-spec &optional node) ¶Return a list of the forward children of NODE, recursively. First child comes first in the resulting list.
history-tree
) owner-spec) ¶Return a list of all OWNER nodes, in unspecified order.
history-tree
) &key owner &allow-other-keys) ¶Return a list of all parents of the current node. Parents may not be owned by the current owner. First parent comes first in the resulting list.
history-tree
) owner-spec &optional count) ¶Go COUNT parent up from the OWNER-SPEC current node, if possible. Return (VALUES HISTORY OWNER).
history-tree
) owner-spec &optional count) ¶Go COUNT parent up from the OWNER-SPEC current node, if possible.
Only contiguous owned parents are considered.
Return (VALUES HISTORY OWNER).
owner
)) ¶owner
)) ¶The owner-id in ‘origin’s parent node that
created this owner. May be nil, in which case ‘origin’ is a root node.
Unless the parent was disowned by this ‘creator-id’,
(gethash (owner history CREATOR-ID) (bindings (parent (origin OWNER))))
should return non-nil.
We store the owner-id instead of the ‘owner’ object so that we keep the information of who created this owner even after the creator object has been deleted.
history-tree
)) ¶history-tree
)) ¶Both the key and the value are an ‘entry’, so that
we can access the actual object from a given piece of data.
Indeed, with custom hash table the key that is store (here the entry) is not
necessarily identical to the one used in ‘gethash’. So storing the entry as a
value gives us access to to the actual object.
history-tree
) owner-spec &optional count) ¶Go COUNT forward-children down from OWNER-SPEC current node, if possible. Return (values HISTORY CURRENT-NODE)) so that ‘backward’ and ‘forward’ calls can be chained.
history-tree
) owner-spec &key child-finder) ¶Go to direct current node’s child matching DATA. Return (values HISTORY OWNER).
history-tree
) owner-spec) ¶Go to current node’s direct owned child matching DATA. A child is owned if it has a binding with OWNER. Return (values OWNER (current OWNER)).
history-tree
)) ¶history-tree
)) ¶Function that returns the hash of the result
of ‘key’ called over an ‘entry’.
Also see ‘test’.
It is a ‘function-symbol’ so that the history can be more easily serialized than
if if were a function.
history-tree
)) ¶history-tree
)) ¶The result of this function is passed to ‘test’
and ‘hash-function’. It is useful to uniquely identify (i.e. avoid
duplications) objects from one of their slots.
It is a ‘function-symbol’ so that the history can be more easily serialized than
if if were a function.
key
.
node
)) ¶Return node’s last access across all its owners. If the node has no owner, return Epoch.
binding
)) ¶Ensure we return last-access as a timestamp, in case it was a string.
binding
)) ¶Timestamp of the last access to this node by the owner.
history-tree
)) ¶history-tree
)) ¶The key is an owner identifier (an artitrary value), the value is an ‘owner’.
history-tree
)) ¶history-tree
)) ¶Function that tests if the two results of ‘key’ called
over two entries are equal.
Also see ‘hash-function’.
It is a ‘function-symbol’ so that the history can be more easily serialized than
if if were a function.
test
.
history-tree
) owner-spec node) ¶Like ‘visit’ but on all nodes between the current node and NODE.
This is only possible if the current node and NODE are on the same branch.
If they are not, an error is raised.
Return (values HISTORY OWNER).
Wrapped data as stored in ‘history-tree”s ‘entries’.
Each entry has a unique datum. Each ‘node’ points to one entry. Multiple nodes
may point to the same entry. Entries may also be node-less; they are kept
around so that we can remember the data that was visited since the beginning of
time. Node-less entries are available for manual deletion with
‘delete-data’.
Required.
This is gives access to the custom hash functions, see the corresponding
‘history-tree’ slots.
We allow null values for easier deserialization.
(or null history-tree:history-tree)
:history
The last access to the corresponding entry by
any owner. It’s useful to keep this access stored here so that when an entry
goes owner-less, we can still consult the last time it was accessed.
(or local-time:timestamp string)
(local-time:now)
:last-access
The list of nodes that access an entry.
list
(quote nil)
:nodes
Starting point of the global history tree data structure.
add-child
.
add-children
.
all-branch-nodes
.
all-children
.
all-contiguous-owned-children
.
all-contiguous-owned-nodes
.
all-contiguous-owned-parents
.
all-data
.
all-forward-children
.
all-owner-nodes
.
all-parents
.
backward
.
backward-owned-parents
.
contiguous-size
.
(setf entries)
.
entries
.
forward
.
go-to-child
.
go-to-owned-child
.
(setf hash-function)
.
hash-function
.
(setf key)
.
key
.
(setf owners)
.
owners
.
size
.
(setf test)
.
test
.
visit
.
visit-all
.
The key is an owner identifier (an artitrary value), the value is an ‘owner’.
hash-table
(make-hash-table :test (function equalp))
:owners
Both the key and the value are an ‘entry’, so that
we can access the actual object from a given piece of data.
Indeed, with custom hash table the key that is store (here the entry) is not
necessarily identical to the one used in ‘gethash’. So storing the entry as a
value gives us access to to the actual object.
hash-table
(history-tree::make-entry-hash-table)
:entries
The result of this function is passed to ‘test’
and ‘hash-function’. It is useful to uniquely identify (i.e. avoid
duplications) objects from one of their slots.
It is a ‘function-symbol’ so that the history can be more easily serialized than
if if were a function.
history-tree::function-symbol
(quote identity)
:key
key
.
Function that tests if the two results of ‘key’ called
over two entries are equal.
Also see ‘hash-function’.
It is a ‘function-symbol’ so that the history can be more easily serialized than
if if were a function.
history-tree::function-symbol
(quote equalp)
:test
test
.
Function that returns the hash of the result
of ‘key’ called over an ‘entry’.
Also see ‘test’.
It is a ‘function-symbol’ so that the history can be more easily serialized than
if if were a function.
history-tree::function-symbol
(quote sxhash)
:hash-function
Node structure of the history tree.
Each node has one parent (unless it’s a root node) and zero or multiple
children. Nodes may have zero or multiple owners.
If nil, it means the node is a root node. (The first of the parents.)
(or null history-tree:node)
:parent
Order does not matter.
list
(quote nil)
:children
The key is an ‘owner’, the value is a
‘binding’. This slot also allows us to know to which owner a node belongs.
(make-hash-table)
:bindings
Required.
(Null entry is accepted only to ease deserialization.)
Arbitrary data (wrapped in an ‘entry’ object) carried
by the node. ‘history-tree”s ‘entries’ holds ‘entry’-‘node’ associations.
(or null history-tree:entry)
:entry
The high-level information about an owner.
Each owner is identified by a unique identifier, which is arbitrary data (may
even be NIL).
The first node created for this owner.
Not to be confused with the root, since the owner be go back to a parent of ‘origin’.
(or null history-tree:node)
:origin
Arbitrary data.
Use it to persist extra owner information to history.
:data
data
.
The owner-id in ‘origin’s parent node that
created this owner. May be nil, in which case ‘origin’ is a root node.
Unless the parent was disowned by this ‘creator-id’,
(gethash (owner history CREATOR-ID) (bindings (parent (origin OWNER))))
should return non-nil.
We store the owner-id instead of the ‘owner’ object so that we keep the information of who created this owner even after the creator object has been deleted.
:creator-id
The current node of the creator when this owner
is created. This is useful since the owner corresponding to ‘creator-id’ may be
deleted before the ‘origin’ node is added.
(or null history-tree:node)
:creator-node
The current node.
It’s updated every time a node is visited.
(or null history-tree:node)
:current
This slot is read-only.
The list of all owned nodes.
(or null (cons history-tree:node))
(quote nil)
:nodes
Like ‘export’, but also evaluated at compile time.
Return the list of all NODE’s children (including NODE) owners.
Return the number of (possibly unowned) parents of OWNER-SPEC cutrent node.
Remove binding between OWNER and NODE.
Return true if NODE was owned by OWNER, nil otherwise.
Return true if all NODE’s children (including NODE) are disowned.
Return nil otherwise.
As a second value, return the list of all NODE’s children, including NODE.
Return the direct child node of OWNER which matches DATA.
Return the nodes matching DATA.
Return the node owned by OWNER which matches DATA.
Return the direct child node owned by OWNER which matches DATA.
Return an ‘entry’ wrapping DATA and suitable for HISTORY.
Return a list of parents of owned by NODE, recursively. First parent comes first in the resulting list.
Return a function which lists the OWNER’s owned children of the node argument.
history-tree
) (owner owner
)) ¶Return the total number of owned nodes contiguous to the current OWNER node.
history-tree
) &key owner &allow-other-keys) ¶Return the total number of nodes for the branch OWNER’s current node sits on.
history-tree
) owner-spec node) ¶Visit NODE with HISTORY’s OWNER-SPEC. Return (values HISTORY OWNER).
The relationship between an owner and one of its nodes.
In particular, it encodes the forward child and the date of last access to the
node for a given owner.
Which of the ‘children’ (in the bound ‘node’) is the child to go forward to for the bound owner.
(or null history-tree:node)
:forward-child
Timestamp of the last access to this node by the owner.
(or local-time:timestamp string)
(local-time:now)
:last-access
Jump to: | (
A B C D E F G H K L M N O P R S T V |
---|
Jump to: | (
A B C D E F G H K L M N O P R S T V |
---|
Jump to: | B C D E F H K L N O P S T |
---|
Jump to: | B C D E F H K L N O P S T |
---|
Jump to: | B C E F H N O P S T |
---|
Jump to: | B C E F H N O P S T |
---|