Skip to content

Instantly share code, notes, and snippets.

@davidrupp
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save davidrupp/1ae6fa19a9ea5bae7b50 to your computer and use it in GitHub Desktop.

Select an option

Save davidrupp/1ae6fa19a9ea5bae7b50 to your computer and use it in GitHub Desktop.

Revisions

  1. davidrupp revised this gist Apr 23, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.clj
    Original file line number Diff line number Diff line change
    @@ -3,5 +3,5 @@
    ; 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 ...
    ; equivalently (kind of) ...
    (alter-var-root #'thing (constantly nil))
  2. davidrupp revised this gist Apr 23, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gistfile1.clj
    Original file line number Diff line number Diff line change
    @@ -3,3 +3,5 @@
    ; 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 ...
    (alter-var-root #'thing (constantly nil))
  3. davidrupp created this gist Apr 23, 2015.
    5 changes: 5 additions & 0 deletions gistfile1.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    (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