The zip-visit library implements zipper-based visitors that allow one to 
carry
and modify state during a depth first traversal of a zipper. There is an
extensive description here:

https://github.com/akhudek/zip-visit

A short example of a zipper-based version of some. Here n is the node and
s is the state:

(defn some-tree-visitor [f]
  (visitor :pre [n s] (if-let [v (f n)] {:state v :break true})))

(defn some-tree [f zipper]
  (:state (visit zipper nil [(some-tree-visitor f)])))

(def my-zip (z/vector-zip [1 3 [4 5 [6] 7 [8 9]]]))

user=> (some-tree #(if (and (number? %) (even? %)) %) my-zip)4

This release includes a bug fix for distinguishing between false and nil. 
The fast-zip-visit 
library is identical, but uses fast-zip instead of clojure.zip.

Alex

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to