clojure
clojure copied to clipboard
How swap! Works with atoms
how swap! on atoms work:
get the value of the atom as it is right now compute the new value it will be after applying the function
if the underlying atom's value is still the same as when we started, "commit" the new value to it. If the underlying value has changed, need to rerun the function on the new state