;; Using :validator to replace the `if`
(def a
(atom 3 :validator pos?))
(swap! a dec)
;; Without using `:validator`, we need to put a `if`
(def b
(atom 3))
(swap! b (fn [n]
(if (pos? (dec n))
(dec n)
(throw (ex-info "content must be positive"
{:a 1})))))