Skip to content

Instantly share code, notes, and snippets.

@atroche
Created November 28, 2017 20:43
Show Gist options
  • Save atroche/2258eed0349c276019d76b6b1fbcf199 to your computer and use it in GitHub Desktop.
Save atroche/2258eed0349c276019d76b6b1fbcf199 to your computer and use it in GitHub Desktop.
(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