Skip to content

Instantly share code, notes, and snippets.

@the80srobot
Created January 10, 2013 13:19
Show Gist options
  • Save the80srobot/4501982 to your computer and use it in GitHub Desktop.
Save the80srobot/4501982 to your computer and use it in GitHub Desktop.
(defmacro define-entity-template
[n & cs]
(let [macro-name (->> n (str "def") symbol)
docstring (if (string? (first cs)) (first cs) "")
cs (if docstring (rest cs) cs)]
;; This is where it gets slightly insane...
`(defmacro ~macro-name ~docstring
[n# & cs#]
(let [docstring# (if (string? (first cs#)) (first cs#) "")
cs# (if docstring# (rest cs#) cs#)]
`(defentity ~n# ~docstring# ~'~@cs ~@cs#))))) ; OMG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment