Created
February 27, 2010 20:55
-
-
Save mmcgrana/316946 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
; orignal code | |
(def putinme (ref {})) | |
(for [itrId #{"A1HHSCH9YA57GL" "A13706T7S3HLRQ" "A2QNYO5VK24YE4"} ] | |
(dosync ( ref-set putinme ( assoc @putinme itrId {:val 1} ))) | |
) | |
@putinme | |
; for is lazy, body here is never executed; consider doseq | |
; use alter to make more concise | |
; you may want atoms instead of refs | |
; suggested code (for refs) | |
(def putinme (ref {})) | |
(doseq [itr-id #{"A1HHSCH9YA57GL" "A13706T7S3HLRQ" "A2QNYO5VK24YE4"}] | |
(dosync (alter putinme assoc itr-id {:val 1}))) | |
@putinme |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment