During the dynamic binding of a symbol to various functions, I assume that you really redefine the function after that.
Think of it this way: your code creates a character and two functions, and you dynamically bind the character to another function:
+---> func1 / symbol ---- [dynamic binding] ---< \ +---> func2
The effect of your dynamic binding is limited to the scope of the binding
call.
What we want to achieve is that, taking into account the symbol and function, provide a new implementation for the function so that all the code that refers to it refers to the new implementation:
(defn func1 [...]) (var func1) ; ---> func1 (defn func1 [...]) (var func1) ; ---> func1*
and such a change constantly affects all the code that func1
uses. This is a common task when you are developing a clojure piece: you will most likely have REPL open in the running application, and you will def
and defn
repeat the same characters over and over again, overriding all moving parts of your application on the fly .
If you use Emacs and SLIME / Swank, each time you press Cc Ck
in a modified Clojure source file, you potentially override all functions in the namespace without having to restart the application.
skuro source share