Functions for navigating and editing of tree-like data structures using a zipper This namespace attempts to duplicate the functionality of clojure.zip.
Functions for navigating and editing of tree-like data structures using a zipper This namespace attempts to duplicate the functionality of clojure.zip.
Insert the item as the rightmost child of the node at this loc, without moving
Insert the item as the rightmost child of the node at this loc, without moving
(append-down loc tree)
Inserts the item as the rightmost child of the tree at this loc
Inserts the item as the rightmost child of the tree at this loc
Return a zipper for nested collections, given a root collection
Return a zipper for nested collections, given a root collection
(edit loc f & args)
Replace the tree at this loc with the value of (f tree args)
Replace the tree at this loc with the value of (f tree args)
Return wormholed loc if loc represents the end of a depth-first walk, otherwise nil
Return wormholed loc if loc represents the end of a depth-first walk, otherwise nil
Insert the item as the leftmost child of the node at this loc, without moving
Insert the item as the leftmost child of the node at this loc, without moving
(leftmost loc)
Returns the loc of the leftmost sibling of the tree at this loc, or self
Returns the loc of the leftmost sibling of the tree at this loc, or self
Return a zipper for nested lists, given a root list
Return a zipper for nested lists, given a root list
(map-zip root-children)
(map-zip root-key root-children)
Return a zipper for nested maps, given a root map of children
Return a zipper for nested maps, given a root map of children
Return a zipper for nested map entries, given a root map entry
Return a zipper for nested map entries, given a root map entry
(next loc)
Moves to the next loc in the hierarchy, depth-first. When reaching the end, returns a distinguished loc detectable via end?. If already at the end, stays there.
Moves to the next loc in the hierarchy, depth-first. When reaching the end, returns a distinguished loc detectable via end?. If already at the end, stays there.
(path loc)
Return a seq of trees leading to this loc
Return a seq of trees leading to this loc
(prev loc)
Moves to the previous loc in the hierarchy, depth-first. If already at the root, returns nil.
Moves to the previous loc in the hierarchy, depth-first. If already at the root, returns nil.
(remove loc)
Remove the node at loc, returning the loc that would have preceded it in a depth-first walk.
Remove the node at loc, returning the loc that would have preceded it in a depth-first walk.
Replaces the node at this loc, without moving
Replaces the node at this loc, without moving
(rightmost loc)
Returns the loc of the leftmost sibling of the tree at this loc, or self
Returns the loc of the leftmost sibling of the tree at this loc, or self
(root loc)
Zip all the way up and return the root, reflecting any changes.
Zip all the way up and return the root, reflecting any changes.
Return a zipper for nested seqs, given a root seq
Return a zipper for nested seqs, given a root seq
Return a zipper for nested seqables, given a root seqable
Return a zipper for nested seqables, given a root seqable
Return a zipper for nested vectors, given a root vector
Return a zipper for nested vectors, given a root vector
Return a zipper for xml elements (as from xml/parse), given a root element
Return a zipper for xml elements (as from xml/parse), given a root element
(zipper branch? children make-node root)
Creates a new zipper structure. Note that zippers created using this function are not serializable.
branch?
is a predicate fn that returns true if the given (sub)tree can have child branches.
children
is a fn that, given a (sub)tree, returns a possibly empty sequence of its subtrees, or nil if it is not a branch.
make-node
is a constructor fn that, given a (sub)tree and a seq of branches, returns a new (sub)tree having the supplied child branches.
root
is the root of the tree.
Creates a new zipper structure. Note that zippers created using this function are not serializable. `branch?` is a predicate fn that returns true if the given (sub)tree can have child branches. `children` is a fn that, given a (sub)tree, returns a possibly empty sequence of its subtrees, or nil if it is not a branch. `make-node` is a constructor fn that, given a (sub)tree and a seq of branches, returns a new (sub)tree having the supplied child branches. `root` is the root of the tree.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close