Loke VanderHart on zippers in Clojure.
From the website:
An introduction to the Clojure zip data structure, which supports fully functional tree navigation and editing. Includes a discussion of how to use the data structure effectively, as well as an overview of its performance characteristics.
I would supplement this presentation with:
“Editing” trees in Clojure with clojure.zip by Brian Marick.
Zippers – Functional Tree Editing (its under Other Included Libraries)
From the webpage:
Clojure includes purely functional, generic tree walking and editing, using a technique called a zipper (in namespace zip) . For background, see the paper by Huet. A zipper is a data structure representing a location in a hierarchical data structure, and the path it took to get there. It provides down/up/left/right navigation, and localized functional ‘editing’, insertion and removal of nodes. With zippers you can write code that looks like an imperative, destructive walk through a tree, call root when you are done and get a new tree reflecting all the changes, when in fact nothing at all is mutated – it’s all thread safe and shareable.
Oh, and the library documentation: API for Clojure.zip