Available since 1.0 (source)
  • (ref x)
  • (ref x & options)
Creates and returns a Ref with an initial value of x and zero or
more options (in any order):
 :meta metadata-map
 :validator validate-fn
 :min-history (default 0)
:max-history (default 10)
 If metadata-map is supplied, it will become the metadata on the
ref. 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. validate-fn will be called on
transaction commit, when all refs have their final values.
 Normally refs accumulate history dynamically as needed to deal with
read demands. If you know in advance you will need history you can
set :min-history to ensure it will be available when first needed (instead
of after a read fault). History is limited, and the limit can be set
with :max-history.