Skip to content

Instantly share code, notes, and snippets.

@shark8me
Created February 23, 2013 08:39
Show Gist options
  • Select an option

  • Save shark8me/5018984 to your computer and use it in GitHub Desktop.

Select an option

Save shark8me/5018984 to your computer and use it in GitHub Desktop.
;this returns the value of :self nodes from the root to the leaf
(defn gpath [n]
"returns that path from the parent till the leaf"
(conj (vec (map :self (zip/path n))) (-> n zip/node :self)))
;path from root to leaf.
(is (= '([20 10 11] [20 10 12] [20 30 31] [20 30 32])
(map (comp gpath) (leafnodes (mzipper mroot)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment