(flatten-text tree & [sep])
Take a tree (sequences hierarchy) and flattens it all the way to a single string (optionally separated by sep). Empty values (but not blank strings) are removed.
Take a tree (sequences hierarchy) and flattens it all the way to a single string (optionally separated by sep). Empty values (but not blank strings) are removed.
(flatten-text* tree)
Take a tree (sequences hierarchy) and flattens it all the way to a single sequence of numbers and strings. Empty values are removed.
Take a tree (sequences hierarchy) and flattens it all the way to a single sequence of numbers and strings. Empty values are removed.
(remove-key tree k)
Walk a tree removing every key/value where key match k
Walk a tree removing every key/value where key match k
(tree-deps trees)
Takes a structure like {:a tree-a :b tree-b :c tree-c} and returns a map like {:a #{:b :c} :b #{:c} :c #{}} which means that :a appears in tree-b and tree-c, :b appears in tree-c, but :c does not appear in tree-a or tree-b.
Takes a structure like {:a tree-a :b tree-b :c tree-c} and returns a map like {:a #{:b :c} :b #{:c} :c #{}} which means that :a appears in tree-b and tree-c, :b appears in tree-c, but :c does not appear in tree-a or tree-b.
(tree-distances trees start & [child-dists])
Applies Djikstra's algorithm to find the shortest paths in trees from start key to all the other top-level nodes/keys. Takes a trees structure, a child-dists map of maps (with all immediate parent-child distances) and a start node. Returns a map of keys from trees with values that are the distance (hops) from the start key to that node/key.
Applies Djikstra's algorithm to find the shortest paths in trees from start key to all the other top-level nodes/keys. Takes a trees structure, a child-dists map of maps (with all immediate parent-child distances) and a start node. Returns a map of keys from trees with values that are the distance (hops) from the start key to that node/key.
(tree-matches pred? tree)
Return seq of pred? matches for any node in the tree.
Return seq of pred? matches for any node in the tree.
(weighted-rand-nth vals-weights & [rnd])
Take a sequence of val-weight pairs (can be a map of val to weights), chooses a weighted random value and returns [idx val].
Take a sequence of val-weight pairs (can be a map of val to weights), chooses a weighted random value and returns [idx val].
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close