API for clojure.zip - Clojure v1.5 (legacy)

by Rich Hickey

Full namespace name: clojure.zip

Overview

Functional hierarchical zipper, with navigation, editing,
and enumeration.  See Huet

Public Variables and Functions



append-child

function
Usage: (append-child loc item)
Inserts the item as the rightmost child of the node at this loc,
without moving

    Added in Clojure version 1.0
Source


branch?

function
Usage: (branch? loc)
Returns true if the node at loc is a branch

    Added in Clojure version 1.0
Source


children

function
Usage: (children loc)
Returns a seq of the children of node at loc, which must be a branch

    Added in Clojure version 1.0
Source


down

function
Usage: (down loc)
Returns the loc of the leftmost child of the node at this loc, or
nil if no children

    Added in Clojure version 1.0
Source


edit

function
Usage: (edit loc f & args)
Replaces the node at this loc with the value of (f node args)

    Added in Clojure version 1.0
Source


end?

function
Usage: (end? loc)
Returns true if loc represents the end of a depth-first walk

    Added in Clojure version 1.0
Source


insert-child

function
Usage: (insert-child loc item)
Inserts the item as the leftmost child of the node at this loc,
without moving

    Added in Clojure version 1.0
Source


insert-left

function
Usage: (insert-left loc item)
Inserts the item as the left sibling of the node at this loc,
without moving

    Added in Clojure version 1.0
Source


insert-right

function
Usage: (insert-right loc item)
Inserts the item as the right sibling of the node at this loc,
without moving

    Added in Clojure version 1.0
Source


left

function
Usage: (left loc)
Returns the loc of the left sibling of the node at this loc, or nil

    Added in Clojure version 1.0
Source


leftmost

function
Usage: (leftmost loc)
Returns the loc of the leftmost sibling of the node at this loc, or self

    Added in Clojure version 1.0
Source


lefts

function
Usage: (lefts loc)
Returns a seq of the left siblings of this loc

    Added in Clojure version 1.0
Source


make-node

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

    Added in Clojure version 1.0
Source


next

function
Usage: (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.

    Added in Clojure version 1.0
Source


node

function
Usage: (node loc)
Returns the node at loc

    Added in Clojure version 1.0
Source


path

function
Usage: (path loc)
Returns a seq of nodes leading to this loc

    Added in Clojure version 1.0
Source


prev

function
Usage: (prev loc)
Moves to the previous loc in the hierarchy, depth-first. If already
at the root, returns nil.

    Added in Clojure version 1.0
Source


remove

function
Usage: (remove loc)
Removes the node at loc, returning the loc that would have preceded
it in a depth-first walk.

    Added in Clojure version 1.0
Source


replace

function
Usage: (replace loc node)
Replaces the node at this loc, without moving

    Added in Clojure version 1.0
Source


right

function
Usage: (right loc)
Returns the loc of the right sibling of the node at this loc, or nil

    Added in Clojure version 1.0
Source


rightmost

function
Usage: (rightmost loc)
Returns the loc of the rightmost sibling of the node at this loc, or self

    Added in Clojure version 1.0
Source


rights

function
Usage: (rights loc)
Returns a seq of the right siblings of this loc

    Added in Clojure version 1.0
Source


root

function
Usage: (root loc)
zips all the way up and returns the root node, reflecting any
changes.

    Added in Clojure version 1.0
Source


seq-zip

function
Usage: (seq-zip root)
Returns a zipper for nested sequences, given a root sequence

    Added in Clojure version 1.0
Source


up

function
Usage: (up loc)
Returns the loc of the parent of the node at this loc, or nil if at
the top

    Added in Clojure version 1.0
Source


vector-zip

function
Usage: (vector-zip root)
Returns a zipper for nested vectors, given a root vector

    Added in Clojure version 1.0
Source


xml-zip

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

    Added in Clojure version 1.0
Source


zipper

function
Usage: (zipper branch? children make-node root)
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.

    Added in Clojure version 1.0
Source
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.