Skip to content

Instantly share code, notes, and snippets.

@Chouser
Created March 3, 2015 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chouser/c7ccb513ac3daa2dfa70 to your computer and use it in GitHub Desktop.
Save Chouser/c7ccb513ac3daa2dfa70 to your computer and use it in GitHub Desktop.
Tag a function to make it available with multiple prefixes.
(defn tag [tags the-var]
(binding [*ns* nil]
(doseq [tag tags]
(intern (in-ns tag) (.sym the-var) @the-var))))
(tag '[A B C]
(defn foo [a b]
(+ a b)))
(A/foo 5 10)
;=> 15
(C/foo 20 22)
;=> 42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment