Atom, Box, Local and other basic reference types.

atom

Available since version 1.0 (alias of clojure.core/atom)

Usage:
  • (atom x)

  • (atom x & options)

Type signatures:
  • (Any) → Atom

  • (Any ⨯ (Va Any)) → Atom

Returns a new atom with an initial value of x and zero or more options:

  • :meta metadata-map - If supplied, it will become the metadata on the atom.

  • :validator 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.

Validator may be also set and managed through its respective function in dunaj.feature namespace.

box

Available since version 1.0 (view source)

Usage:
  • (box x)

Type signature:
  • (Any) → Box

Returns a boxed x, an object which implements IReference. Dereferencing such object returns back the original value.

local

Available since version 1.0 (view source)

Usage:
  • (local val)

  • (local val thread)

Type signatures:
  • (Any) → Local

  • (Any ⨯ (Maybe Thread+)) → Local

Returns new reference to val, local to the given thread, or to the current one, if thread is not explicitly given. thread can be nil, in that case returned reference can be mutated from any thread and is effectively a volatile reference. The returned reference can be read or cloned from any thread. Cloning returns new reference thread local to the caller.

unsynchronized-reference

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (unsynchronized-reference val)

Type signature:
  • (Any) → Raw

Returns new unsynchronized reference to val.

Low level. You are discouraged to use this function.

volatile-reference

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (volatile-reference val)

Type signature:
  • (Any) → Volatile

Returns new volatile reference to val.

Low level. You are discouraged to use this function.