Skip to content

Instantly share code, notes, and snippets.

@tonyseing
Created October 9, 2014 09:45
Show Gist options
  • Save tonyseing/7b95e58dcd4bfcd1ec11 to your computer and use it in GitHub Desktop.
Save tonyseing/7b95e58dcd4bfcd1ec11 to your computer and use it in GitHub Desktop.
(defmacro r-infix [form]
(cond (not (seq? form))
form
(= 1 (count form))
`(r-infix ~(first form))
:else
(let [operator (second form)
first-arg (first form)
others (rest (rest form
))]
`(~operator
(r-infix ~first-arg)
(r-infix ~others)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment