Liking cljdoc? Tell your friends :D

clj-foundation.tree-visit

Traverse arbitrary Clojure data structures using a visitor (cursor).

Thanks to: http://www.ibm.com/developerworks/library/j-treevisit/

Traverse arbitrary Clojure data structures using a visitor (cursor).

Thanks to: http://www.ibm.com/developerworks/library/j-treevisit/
raw docstring

depthclj

(depth loc)

Return the number of traversals required to reach the current node starting from the root node.

Return the number of traversals required to reach the current node starting
from the root node.
sourceraw docstring

indexclj

(index loc)

Return the 0-based position of the current element inside its collection. This value is only meaningful if the current collection is sequential.

Return the 0-based position of the current element inside its collection.
This value is only meaningful if the current collection is sequential.
sourceraw docstring

node-atclj

(node-at loc & traversal-fns)

Return the data node starting at cursor after applying zip/traversal-fns. Returns patterns/NO-RESULT-ERROR if there is no node at the specified position.

Return the data node starting at cursor after applying zip/traversal-fns.
Returns patterns/NO-RESULT-ERROR if there is no node at the specified position.
sourceraw docstring

parent-containerclj

(parent-container loc)

Return's the current node's parent container. If the current node is the root node, returns the current node.

Return's the current node's parent container.  If the current node is the
root node, returns the current node.
sourceraw docstring

root-node?clj

(root-node? n)

Is the cursor at the root of the collection?

Is the cursor at the root of the collection?
sourceraw docstring

traversable-coll?clj

(traversable-coll? node)

Is this a kind of collection we can traverse?

Is this a kind of collection we can traverse?
sourceraw docstring

tree-branch?cljmultimethod

source

tree-childrencljmultimethod

source

tree-make-nodecljmultimethod

source

tree-visitorclj

(tree-visitor zipper visitors)
(tree-visitor zipper initial-state visitors)
source

tree-zipperclj

(tree-zipper node)
source

update-breadcrumbclj

(update-breadcrumb old-path loc)

A breadcrumb vector contains the human-readable path from the root object to the current one in a tree-visit session.

Starting with [] representing the root object in a Clojure nested graph, to maintain the breadcrumb vector, after traversing to a new loc with a call to (zip/next cursor) or similar, call (update-breadcrumb old-breadcrumb new-loc) to obtain a new breadcrumb vector corresponding with the new location.

A breadcrumb vector contains the human-readable path from the root object to
the current one in a tree-visit session.

Starting with [] representing the root object in a Clojure nested graph, to
maintain the breadcrumb vector, after traversing to a new loc with a call to
(zip/next cursor) or similar, call (update-breadcrumb old-breadcrumb new-loc)
to obtain a new breadcrumb vector corresponding with the new location.
sourceraw docstring

visit-nodeclj

(visit-node start-node start-state visitors loc)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close