ClojureDocs

Nav

Namespaces

Take the 2025 State of Clojure Survey! Help shape the future of Clojure. Take Survey →

with-redefs-fn

clojure.core

Available since 1.3 (source)
  • (with-redefs-fn binding-map func)
Temporarily redefines Vars during a call to func.  Each val of
binding-map will replace the root value of its key which must be
a Var.  After func is called with no args, the root values of all
the Vars will be set back to their old values.  These temporary
changes will be visible in all threads.  Useful for mocking out
functions during testing.