Skip to content

clojure.zip/zipper

View this page on ClojureDocs

Type: function Added: Clojure 1.0 Examples: 4 Runnable: 0
([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.

Examples

by bhenry on . May have evaluation errors.
by muhuk on . May have evaluation errors.
by PetrGlad on . May have evaluation errors.
by PetrGlad on . May have evaluation errors.

Note by zk

For more info on zippers:

Note by jafingerhut

Tutorials on zippers:

Note by PetrGlad

To work with nested structures you can also use * clojure.core/get-in, clojure.core/assoc-in, clojure.core/update-in * Balagan library https://github.com/clojurewerkz/balagan * Specter library https://github.com/nathanmarz/specter

See also


Content from the matching ClojureDocs page, with authors credited on each contribution.