I have a number of atoms in my code where a common requirement is to update them to a new value, regardless of the current value.
I therefore find myself writing something like this:
(swap! atom-name (fn [_] (identity new-value)))
This works but seems pretty ugly and presumably incurs a performance penalty for constructing the anonymous closure.
Is there a better way?