Skip to content

Instantly share code, notes, and snippets.

@Crowbrammer
Created May 25, 2022 17:21
Show Gist options
  • Save Crowbrammer/ac234d94bed12db539d850bab58dd7fa to your computer and use it in GitHub Desktop.
Save Crowbrammer/ac234d94bed12db539d850bab58dd7fa to your computer and use it in GitHub Desktop.
Change the value vs. change where the variable points to.
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