# zip-next - https://clojuredocs.org/clojure.zip/next ;; zip-walk takes a transformation function f and a zipper z. ;; f takes a location and returns location. Applies f ;; to the nodes in the zipper maintaining the original nesting. (require '[clojure.zip :as zip]) (defn zip-walk [f z] (if (zip/end? z) (zip/root z) (recur f (zip/next (f z))))) (zip-walk (fn [loc] (if (zip/branch? loc) loc (zip/edit loc * 2))) (zip/vector-zip [1 2 [3 4]])) ;; [2 4 [6 8]]