ClojureDocs

Namespaces

clojure.zip

Functional tree editing and manipulation. One of the core benefits of using Clojure is that you mostly work with immutable data structures. This, in turn, seems to make your programs easier to build and maintain.

Community Links
Vars in clojure.zip

a

append-child
Inserts the item as the rightmost child of the node at this loc, without moving

b

branch?
Returns true if the node at loc is a branch

c

children
Returns a seq of the children of node at loc, which must be a branch

d

down
Returns the loc of the leftmost child of the node at this loc, or nil if no children

e

edit
Replaces the node at this loc with the value of (f node args)
end?
Returns true if loc represents the end of a depth-first walk

i

insert-child
Inserts the item as the leftmost child of the node at this loc, without moving
insert-left
Inserts the item as the left sibling of the node at this loc, without moving
insert-right
Inserts the item as the right sibling of the node at this loc, without moving

l

left
Returns the loc of the left sibling of the node at this loc, or nil
leftmost
Returns the loc of the leftmost sibling of the node at this loc, or self
lefts
Returns a seq of the left siblings of this loc

m

make-node
Returns a new branch node, given an existing node and new children. The loc is only used to supply the constructor.

n

next
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.
node
Returns the node at loc

p

path
Returns a seq of nodes leading to this loc
prev
Moves to the previous loc in the hierarchy, depth-first. If already at the root, returns nil.

r

remove
Removes the node at loc, returning the loc that would have preceded it in a depth-first walk.
replace
Replaces the node at this loc, without moving
right
Returns the loc of the right sibling of the node at this loc, or nil
rightmost
Returns the loc of the rightmost sibling of the node at this loc, or self
rights
Returns a seq of the right siblings of this loc
root
zips all the way up and returns the root node, reflecting any changes.

s

seq-zip
Returns a zipper for nested sequences, given a root sequence

u

up
Returns the loc of the parent of the node at this loc, or nil if at the top

v

vector-zip
Returns a zipper for nested vectors, given a root vector

x

xml-zip
Returns a zipper for xml elements (as from xml/parse), given a root element

z

zipper
Creates a new zipper structure. branch? is a fn that, given a node, returns true if can have children, even if it currently doesn't. children is a fn that, given a branch node, returns a seq of its children. make-node is a fn that, given an existing node and a seq of children, returns a new branch node with the supplied children. root is the root node.