Created
January 27, 2014 09:41
Revisions
-
mattfield created this gist
Jan 27, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ (defn tree-searcher "Parse through every node in a tree and check against give matcher function. If a match succeeds, return the node. If no match is found after all recursions, just return the tree. Also see clojure.walk" [zipper matcher] (loop [loc zipper] (if (zip/end? loc) (zip/root loc) (if-let [matcher-result (matcher (zip/node loc))] (matcher-result) (recur (zip/next loc))))))