Skip to main content

swap-vals!

functionv1.9

clojure.core/swap-vals!

Available in:BBCLJCLJS
(swap-vals! [atom f] [atom f x] [atom f x y] [atom f x y & args])
Atomically swaps the value of atom to be: (apply f current-value-of-atom args). Note that f may be called multiple times, and thus should be free of side effects. Returns [old new], the value of the atom before and after the swap.

No examples yet. Be the first to add one!