Created
March 5, 2015 14:16
-
-
Save joshkh/ab045d64e8952344cf92 to your computer and use it in GitHub Desktop.
clojure atom example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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