Skip to content

Instantly share code, notes, and snippets.

@egamble
Created December 8, 2011 22:46
Show Gist options
  • Save egamble/1449057 to your computer and use it in GitHub Desktop.
Save egamble/1449057 to your computer and use it in GitHub Desktop.
Recursively macroexpand to depth n
(defn macroexpand-n [n form]
(if (zero? n)
form
(recur (dec n)
(macroexpand-1 form))))
@amalloy
Copy link

amalloy commented Dec 9, 2011

(defn macroexpand-n [n form]
  (nth (iterate macroexpand-1 form) n))

@egamble
Copy link
Author

egamble commented Dec 9, 2011 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment