(atom x)
(atom x & {:keys [meta validator]})
Creates and returns an Atom with an initial value of x and zero or
more options (in any order):
:meta metadata-map
:validator validate-fn
If metadata-map is supplied, it will be come the metadata on the
atom. validate-fn must be nil or a side-effect-free fn of one
argument, which will be passed the intended new state on any state
change. If the new state is unacceptable, the validate-fn should
return false or throw an Error. If either of these error conditions
occur, then the value of the atom will not change.
Source
(defn
atom
"Creates and returns an Atom with an initial value of x and zero or\n more options (in any order):\n\n :meta metadata-map\n\n :validator validate-fn\n\n If metadata-map is supplied, it will be come the metadata on the\n atom. validate-fn must be nil or a side-effect-free fn of one\n argument, which will be passed the intended new state on any state\n change. If the new state is unacceptable, the validate-fn should\n return false or throw an Error. If either of these error conditions\n occur, then the value of the atom will not change."
([x] (Atom. x nil nil nil))
([x & {:keys [meta validator]}] (Atom. x meta validator nil)))