Skip to content

Instantly share code, notes, and snippets.

@egamble
Created December 8, 2011 22:46
Show Gist options
  • Select an option

  • Save egamble/1449057 to your computer and use it in GitHub Desktop.

Select an option

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

amalloy commented Dec 9, 2011

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

@egamble

egamble commented Dec 9, 2011 via email

Copy link
Copy Markdown
Author

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