Created
February 1, 2012 01:10
-
-
Save dgrnbrg/1714329 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 defn-errors | |
"Like defn, but allows any number of the | |
argument to throw errors, using join-errors" | |
[name & args] | |
(let [[name [params & body]] (name-with-attributes | |
name args) | |
param-sym (gensym "params")] | |
`(defmacro ~name [& ~param-sym] | |
`(apply (fn [~@'~params] ~@'~body) | |
(join-errors | |
~@~param-sym))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment