I have an atom,
(def a (atom {:a <some-value>}))
and it needs to be updated continuously, what would be the most memory efficient call in the long run…?
(swap! a assoc :a <next-value>)
or
(swap! a (fn [_] {:a <next-value>}))
Intuitively, based on the talks I have heard on persistent structures, I’m thinking that the second way would be a little slower but better in the long-run… but would like a second opinion.
reset!, notswap!.swap!function that takes the old value into account.