Skip to content

stoyle/clojure-mutable-namespace-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Small repo showing mutability of Vars/Namespaces

In Clojure it is a convention not to “change Vars” in production systems, but Clojure itself will not stop you from doing bad things. The reason for this “utility” is so that the repl can function well.

It is not really the Var itself that is mutated rather the Var root binding, or the actual namespace in which it is located.

For the record, the only official way to change a Var is through thread local binding, or the alter-var-root function.

This leiningen project is set up so that it is compiled ahead of time. So you can run the code by:

lein uberjar
java -jar clojure-mutable-namespace-example-1.0.0-SNAPSHOT-standalone.jar

About

Showing how namespaces/vars are mutable in Clojure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published