clojure.zip/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.
Examples¶
Note by zk¶
For more info on zippers:
- Brian Marick: “Editing� trees in Clojure with clojure.zip
- Alex Miller: Zippers with records in Clojure
Note by jafingerhut¶
Tutorials on zippers:
-
Brian Marick: "Editing" trees in Clojure with clojure.zip
-
Alex Miller: Zippers with records in Clojure
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¶
- clojure.zip/down
- clojure.zip/up
- clojure.zip/right
- clojure.zip/left
- clojure.zip/children
- clojure.zip/node
- clojure.zip/replace
Content from the matching ClojureDocs page, with authors credited on each contribution.