Created
April 20, 2010 22:09
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
;simulates heavy asychronous state change | |
(defn start-frequent-changes [& some-refs] | |
(let [change (fn [value] | |
(cond | |
(pos? value) (inc value) | |
(neg? value) (dec value) | |
:else (identity value)))] | |
(doseq [a-ref some-refs] | |
(future (loop [] (Thread/sleep 200) (dosync (alter a-ref change)) (recur))) | |
(Thread/sleep 100)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment