Created
May 25, 2022 17:21
-
-
Save Crowbrammer/ac234d94bed12db539d850bab58dd7fa to your computer and use it in GitHub Desktop.
Change the value vs. change where the variable points to.
This file contains 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
user=> (def x (atom 1)) | |
#'user/x | |
user=> (def y x) | |
#'user/y | |
user=> @x | |
1 | |
user=> @y | |
1 | |
user=> (swap! x inc) | |
2 | |
user=> @y | |
2 | |
user=> @x | |
2 | |
user=> (alter-var-root #'x (fn [_] "Hello")) | |
"Hello" | |
user=> @y | |
2 | |
user=> x | |
"Hello" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment