Clojure - Reference Values
Reference values are another way Clojure can work with the demand to have mutable variables. Clojure provides mutable data types such as atoms, agents, and reference types.
Following are the operations available for reference values.
|Sr.No.||Operations & Description|
This is used to create a reference value. When creating a reference value, there is an option to provide a validator function, which will validate the value created.
This function is used to set the value of a reference to a new value irrespective of whatever is the older value.
This function is used to alter the value of a reference type but in a safe manner. This is run in a thread, which cannot be accessed by another process.
Runs the expression (in an implicit do) in a transaction that encompasses expression and any nested calls.
Commute is also used to change the value of a reference type just like alter and ref-set.