clojure.core/atom¶
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 become 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 exception.
Examples¶
See also¶
- clojure.core/reset!
- clojure.core/swap! (6)
- clojure.core/compare-and-set! (1)
- clojure.core/add-watch (3)
- clojure.core/remove-watch
- clojure.core/set-validator! (0)
- clojure.core/swap-vals!
- clojure.core/reset-vals!
- clojure.core/ref-set
Content from the matching ClojureDocs page, with authors credited on each contribution.