Created
December 17, 2019 16:00
-
-
Save sw-samuraj/cd0c97c540846b0e07e0e9bfe4771cab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def counter (ref 0 :validator number?)) | |
; #'user/counter | |
(dosync (ref-set counter "string")) | |
; IllegalStateException Invalid reference state clojure.lang.ARef.validate (ARef.java:33) | |
@counter | |
; 0 | |
(dosync (ref-set counter 42)) | |
; 42 | |
@counter | |
; 42 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment