Skip to content

Instantly share code, notes, and snippets.

Created April 25, 2011 15:14
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 anonymous/940651 to your computer and use it in GitHub Desktop.
Save anonymous/940651 to your computer and use it in GitHub Desktop.
define function with its source as metadata
(defmacro defn+
[& params]
`(do
(defn ~@params)
(def ~(first params)
(with-meta
~(first params)
{:source (str
"(defn "
~@(interleave (map str params) (repeat " "))
")"
)}))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment