Skip to content

Instantly share code, notes, and snippets.

@davidrupp
Last active August 29, 2015 14:19
Show Gist options
  • Save davidrupp/1ae6fa19a9ea5bae7b50 to your computer and use it in GitHub Desktop.
Save davidrupp/1ae6fa19a9ea5bae7b50 to your computer and use it in GitHub Desktop.
alter-var-root-constantly-4
(def thing 1)
(alter-var-root #'thing (fn [old-val] nil)) ; value of thing is now nil
; we don't really need to name the argument, because we don't use it
; but we *do* need to include it; otherwise we'll get an arity exception
(alter-var-root #'thing (fn [_] nil)) ; value of thing is now nil
; equivalently (kind of) ...
(alter-var-root #'thing (constantly nil))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment