Skip to content

Instantly share code, notes, and snippets.

@KingMob
Created April 22, 2022 09:12
Show Gist options
  • Save KingMob/7c38cf0407698ebd7cebe00b4f3f70e8 to your computer and use it in GitHub Desktop.
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.
(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