Skip to content

Instantly share code, notes, and snippets.


Quân quan-nh

Block or report user

Report or block quan-nh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am quan-nh on github.
  • I am quannh ( on keybase.
  • I have a public key ASALhdAKTdAZjTn2Os-e4FvnCS5iyEB02SF354Wzw_gpJAo

To claim this, I am signing this object:

quan-nh / [clj]
Last active Apr 14, 2017
Understanding the difference between lexical and dynamic scope in Clojure.
View [clj]


  • lexical scope (static scope): dependent only on the program text.
  • dynamic scope: dependent on the runtime call stack.


  • (def x 1) default Var is static, using let for local Var, with-redefs to change the root binding var within its scope (visible in all threads).
  • (def ^:dynamic x 1) dynamic Var, using binding to change value (thread-local, cannot be seen by any other thread).

In example bellow:

  • binding only changes the value of *dynamic-var* within the scope of the binding expression
You can’t perform that action at this time.