Skip to content

Instantly share code, notes, and snippets.

@MayDaniel
Created September 26, 2010 15:07
Show Gist options
  • Save MayDaniel/597998 to your computer and use it in GitHub Desktop.
Save MayDaniel/597998 to your computer and use it in GitHub Desktop.
(defmacro do-when
{:arglists '([test then & more])}
[& clauses]
(if-not (even? (count clauses))
(throw (IllegalArgumentException. "do-when requires an even number of clauses."))
(cons 'do (map (partial cons 'when)
(partition 2 clauses)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment