David J.
David J.

Reputation: 32715

Unbind a Clojure var

Let's say I have a dynamic var that starts off unbound:

(def ^:dynamic *config-param*)

Then, later, it is set like this:

(alter-var-root #'*config-param* (constantly 42)))

But, now, I want to unbind it (perhaps for testing purposes). How do I do it?

(Note: I am not endorsing the use of dynamic variables! I'm just asking.)

Upvotes: 1

Views: 554

Answers (1)

David J.
David J.

Reputation: 32715

Use .unbindRoot like this:

(.unbindRoot #'*config-param*)

Upvotes: 1

Related Questions