Quantcast
Channel: Get the state of an atom, and reset it atomically - Stack Overflow
Browsing latest articles
Browse All 3 View Live

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 Article



Answer 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 Article

Get 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
Browsing latest articles
Browse All 3 View Live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>