Answer by Josh for Get the state of an atom, and reset it atomically
There is currently a JIRA ticket dealing with this very request. In the meantime, this does what you want, and is similar to what's in the patch, though I only browsed the code:(defn reset-return-old!...
View ArticleAnswer by Alan Thompson for Get the state of an atom, and reset it atomically
One simple answer is to use a Clojure ref instead of an atom. It allows you to lock the value for more than a single function invocation (unlike swap):(ns tst.clj.core (:use clj.core clojure.test...
View ArticleGet the state of an atom, and reset it atomically
I'm writing a Mandelbrot Set implementation, and to speed up finding out which points go off into infinity, I decided to try using an ExecutorService to check the points in parallel.Basically the plan...
View Article
More Pages to Explore .....