Created
November 28, 2017 20:43
-
-
Save atroche/2258eed0349c276019d76b6b1fbcf199 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
(require '[think.parallel.core :as par]) | |
(let [new-val (inc counter)] | |
(alter-var-root #'counter (constantly 100)) | |
(let [vals (binding [counter 50] | |
(par/queued-pmap 50 (fn [_] counter) (range 200)))] | |
(alter-var-root #'counter (constantly 400)) | |
(println vals))) | |
(println counter) | |
(dotimes [i 100] | |
(future | |
(let [new-val (inc counter)] | |
(alter-var-root #'counter (fn [v] | |
(inc v)))))) | |
(println counter) | |
(var 'a) | |
(binding [a 4] | |
(println a)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment