Created
October 18, 2014 13:21
-
-
Save jboverfelt/fbaaf5666fe16c291c17 to your computer and use it in GitHub Desktop.
Example of syntax transformation. This is a simple macro but demonstrates the flexibility of being able to define your own syntax
This file contains 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 foreach [& body] | |
(let [parts (partition-by #{'in 'do} body) | |
[v _ lst _ forms] parts] | |
`(doseq [~(first v) ~(first lst)] (do ~@forms)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment