Skip to content

Instantly share code, notes, and snippets.

@dgrnbrg
Created February 1, 2012 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgrnbrg/1714329 to your computer and use it in GitHub Desktop.
Save dgrnbrg/1714329 to your computer and use it in GitHub Desktop.
(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