Dynamic Binding in Clojure
Clojure has a binding
method that allows you to stub out a method. According
to the (cdoc binding)
, one example is:
Unfortunately this doesn’t work anymore. When you run it, you’ll get this error:
The only way to fix it is by defining the method as dynamic.
I’m able to do this for my own code, but I haven’t figured out how to alter the
meta data for an existing function, such as the max
used in the example
above.
Comment: you can do this for existing functions using with-redefs