fun pathological atom situation
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
(def a (atom 0)) | |
(def f1 (future | |
(while (< @a 1000000000) | |
(swap! a inc)) | |
(println "Done incrementing!"))) | |
(def f2 (future | |
(swap! a (fn [current-val] | |
(println "Trying...`a' is" current-val) | |
(Thread/sleep 10) ; actually usually works without this, just from the delay println introduces | |
0)) | |
(println "Successfully reset!"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment