Skip to content

Instantly share code, notes, and snippets.

@ertugrulcetin
Created November 21, 2020 21:04
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 ertugrulcetin/fa34f464595d1b313705289521814f9c to your computer and use it in GitHub Desktop.
Save ertugrulcetin/fa34f464595d1b313705289521814f9c to your computer and use it in GitHub Desktop.
Clojure nested macro sample
(defmacro component
([name tag]
`(component ~name ~tag nil))
([name tag docs]
(if docs
`(defmacro ~(with-meta name {:tag tag}) ~docs
[object# k# & options#]
`(u/call! ~object# ~k# ~@options#))
`(defmacro ~(with-meta name {:tag tag})
[object# k# & options#]
`(u/call! ~object# ~k# ~@options#)))))
(component sphere
com.badlogic.gdx.math.collision.Sphere
"Calls a single method on a `sphere`.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment