Create a gist now

Instantly share code, notes, and snippets.

@wagjo /gist:8786305
Last active Aug 29, 2015

What would you like to do?
(defprotocol IMutable
(-cas! [o oldval newval]
"Sets the value to newval if and only if the current value
is identical to oldval. Returns true if set happened,
otherwse returns false. Mutates `o`.")
(-alter! [o f] [o f x] [o f x y] [o f x y z] [o f x y z args]
"Changes referenced value with (apply f val args).
Returns new value. Mutates `o`.")
(-reset! [o val]
"Resets the referenced value to `val`.
Returns new value. Mutates `o`."))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment