README describes what ranked trees are.
This namespace provides recognizable functions for manipulating them.
README describes what ranked trees are. This namespace provides recognizable functions for manipulating them.
(assoc tree ranks v)
(assoc tree ranks path v)
Associates v
at path
which is then prioritized using ranks
.
When path
is not provided, associates directly after the ranks.
Cf. Namespace description for an example.
Associates `v` at `path` which is then prioritized using `ranks`. When `path` is not provided, associates directly after the ranks. Cf. Namespace description for an example.
(dissoc tree ranks)
(dissoc tree ranks path)
Dissociates a value located at path
and prioritized by ranks
.
When path
is not provided, dissociates everything for the given ranks
.
Dissociates a value located at `path` and prioritized by `ranks`. When `path` is not provided, dissociates everything for the given `ranks`.
(get tree ranks)
(get tree ranks path)
(get tree ranks path not-found)
Find a value located at path
that has been prioritized with ranks
.
When path is not provided, returns everything at the given ranks
.
Find a value located at `path` that has been prioritized with `ranks`. When path is not provided, returns everything at the given `ranks`.
(pop tree)
Respecting the ordering of ranks, returns a vector such as:
i | meaning |
---|---|
0 | tree after popping |
1 | ranks that led to node |
2 | popped unsorted node at ranks |
There might be no node to pop, and after popping a empty tree is returned as nil.
Respecting the ordering of ranks, returns a vector such as: | i | meaning | |---|---| | 0 | tree after popping | | 1 | ranks that led to node | | 2 | popped unsorted node at ranks | There might be no node to pop, and after popping a empty tree is returned as nil.
(pop-walk tree f)
(pop-walk tree popped-tree->acc f)
Pops the given ranked tree
and then walks the unsorted node in a depth-first manner by applying:
(f acc
ranks
path
leaf)
After popping but before walking the unsorted node, the popped tree is transformed into acc
by calling popped-tree->acc
(defaulting to Clojure's identity
).
See also pop
.
Pops the given ranked `tree` and then walks the unsorted node in a depth-first manner by applying: ```clojure (f acc ranks path leaf) ``` After popping but before walking the unsorted node, the popped tree is transformed into `acc` by calling `popped-tree->acc` (defaulting to Clojure's `identity`). See also [[pop]].
(r+ ranks-1 ranks-2)
Sums the given rank collections which might be of different length.
(r+ [0 5]
[10 10 10])
[10 15 10]
Sums the given rank collections which might be of different length. ```clojure (r+ [0 5] [10 10 10]) [10 15 10] ```
(tree)
Simply provides a sorted map, reminding that a ranked tree always start with at least one sorted map.
Should be used just in case the implementation changes and uses something else than Clojure's sorted maps.
Simply provides a sorted map, reminding that a ranked tree always start with at least one sorted map. Should be used just in case the implementation changes and uses something else than Clojure's sorted maps.
(update tree ranks f)
(update tree ranks path f)
Update the value located at path
and prioritized by ranks
When path
is not provided, updates whatever there is at the given ranks
.
If the result of applying f
is nil, the value is removed.
Update the value located at `path` and prioritized by `ranks` When `path` is not provided, updates whatever there is at the given `ranks`. If the result of applying `f` is nil, the value is removed.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close