Skip to content

Instantly share code, notes, and snippets.

@si14
Created March 11, 2012 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save si14/2016505 to your computer and use it in GitHub Desktop.
Save si14/2016505 to your computer and use it in GitHub Desktop.
(defn leafcount-rec [children root]
(let [root-children (get-uuids (root children))]
(if (empty? root-children) [root 1]
(let [children-leafs (doall (mapcat #(leafcount-rec children %)
root-children))
ttt (do (log root) (log (vec children-leafs)) 1)
root-leafs (apply + (filter integer? children-leafs))]
(concat [root root-leafs] children-leafs)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment