Skip to content

Instantly share code, notes, and snippets.

@Crowbrammer
Created May 25, 2022 17:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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