Skip to content

Instantly share code, notes, and snippets.

@AyeGill
Created June 24, 2013 13:18
Show Gist options
  • Save AyeGill/5849972 to your computer and use it in GitHub Desktop.
Save AyeGill/5849972 to your computer and use it in GitHub Desktop.
(defn getvals [form] (cond (seq? form) form (vector? form) (seq form) (map? form) (map second (seq form)) true false))
(defn getleaves [tree] (let [vals (getvals tree)]
(if vals (mapcat getleaves vals)
(list tree))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment