Created
May 26, 2016 14:02
-
-
Save noisesmith/23299a02ff7f84ed49dd4bab442a8855 to your computer and use it in GitHub Desktop.
clojure vars are mutated, if they exist in the ns, but otherwise a new var is created
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
| +user=> (def x 1) | |
| #'user/x | |
| +user=> (def the-x #'x) | |
| #'user/the-x | |
| +user=> (ns-unmap 'user 'x) | |
| nil | |
| +user=> @the-x ; the var is captured, so we can still use it | |
| 1 | |
| +user=> (def x 2) | |
| #'user/x | |
| +user=> @the-x ; def made a new var, old value is unchanged | |
| 1 | |
| +user=> x | |
| 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment