! impure

conventionsince v0.0-927 in clojureEdit

A naming convention sometimes applied to functions that perform mutations. Examples:


Details:

In Clojure, it is used only for things not safe in an STM transaction (source), which does not apply to ClojureScript because its compilation target, JavaScript, is single-threaded.


Examples:

The following causes a side-effect in the state of a:

(def a (atom 1))
@a
;;=> 1

(reset! a 2)
@a
;;=> 2

See Also: