Skip to content

Instantly share code, notes, and snippets.

@joshkh
Created March 5, 2015 14:16
Show Gist options
  • Save joshkh/ab045d64e8952344cf92 to your computer and use it in GitHub Desktop.
Save joshkh/ab045d64e8952344cf92 to your computer and use it in GitHub Desktop.
clojure atom example
(defn get-all-projects []
(let [results (sql-get-all-projects)
acc (atom [])]
(info "modified" modified)
(doseq [next_project results]
(let [project_contents (sql-get-single-project (:id next_project))
project_with_contents (assoc next_project :contents project_contents)]
(info "project_with_contents" project_with_contents)
(swap! modified conj project_with_contents)))
(info "modified" (deref modified))
(json/generate-string results {:pretty true})))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment