I like using tree-seq and core.match when working on instaparse ASTs - like this:
(require ['clojure.core.match :as 'm]) (def s [{"n" {"id" "a"} "d" 2 "children" [{"n" {"id" "c"} "d" 4 "children" nil}]} {"n" {"id" "b"} "d" 3 "children" nil}]) ;; top-down-traversal (defn nodes [x] (tree-seq coll? seq x)) ;; target pred (defn sel-pred [n] (and (map? n) (some #{{"id" "c"}} (vals n)))) (some (fn [x] (m/match x (_ :guard #(sel-pred %)) x :else nil)) (tree-seq coll? seq s)) The guard is a little clumbsy but as far as I can see match does not support map-matches with binding-keys like {k {"id" "c"}}. -- 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.