Created
October 9, 2014 09:45
-
-
Save tonyseing/7b95e58dcd4bfcd1ec11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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