Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
->>> Sample Macro
(defn replace-if-underscore [element val]
(if (= element '_)
val
element))
(defn replace-underscores [form val]
(map #(replace-if-underscore % val) form))
(defn convert-forms [val [next-form & other-forms]]
(if (nil? next-form)
val
(let [next-val (gensym)]
`(let [~next-val ~(replace-underscores next-form val)]
~(convert-forms next-val other-forms)))))
(defmacro ->>> [init & forms]
(convert-forms init forms))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment