Skip to content

Instantly share code, notes, and snippets.

@gtrak gtrak/gist:1928815
Created Feb 28, 2012

Embed
What would you like to do?
static hiccup generation
(defmacro defpartial
"Create a function that returns html using hiccup. The function is
callable with the given name."
[fname params & body]
`(defn ~fname ~params
(h.core/html
~@body)))
(defmacro fn-partial
"Create a function that returns html using hiccup."
[params & body]
`(fn ~params
(h.core/html
~@body)))
(defmacro defpartial-static
"Pre-render on compilation, no params"
[name & body]
(let [b `(fn-partial [] ~@body)
value ((eval b))]
`(defpartial ~name []
~value)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.