(defn
reset!
"Sets the value of atom to newval without regard for the\n current value. Returns new-value."
[a new-value]
(if
(instance? Atom a)
(let
[validate (.-validator a)]
(when-not
(nil? validate)
(when-not
(validate new-value)
(throw (js/Error. "Validator rejected reference state"))))
(let
[old-value (.-state a)]
(set! (.-state a) new-value)
(when-not
(nil? (.-watches a))
(-notify-watches a old-value new-value))
new-value))
(-reset! a new-value)))