Created
April 22, 2022 09:12
-
-
Save KingMob/7c38cf0407698ebd7cebe00b4f3f70e8 to your computer and use it in GitHub Desktop.
defmulti+, an enhanced version of defmulti that unmaps itself from the ns when present. Eases the pain of redefining the dispatch method at the REPL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro defmulti+ | |
"An enhanced version of defmulti that unmaps itself from the ns when present. | |
Eases the pain of redefining the dispatch method at the REPL." | |
[name & args] | |
`(do | |
(when (resolve '~name) | |
(ns-unmap *ns* '~name)) | |
(defmulti ~name ~@args))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment