Skip to content

Instantly share code, notes, and snippets.

@joshkh
Created March 5, 2015 18:30
Show Gist options
  • Save joshkh/83a5994c9b546bdf996a to your computer and use it in GitHub Desktop.
Save joshkh/83a5994c9b546bdf996a to your computer and use it in GitHub Desktop.
make-tree
(defn make-tree-orig
([coll] (info "SINGLERUN")(let [root (first (remove :parent_id coll))]
{:node root :children (make-tree-orig root coll)}))
([root coll list]
(info "DOUBLERUN") (for [x coll :when (= (:parent_id x) (:id root))]
{:node x :children (make-tree-orig x coll)})))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment