-
-
Save rightfold/0c49f29105a8d67b93ee to your computer and use it in GitHub Desktop.
This file contains 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 cond-let [name & cases] | |
(when-not (even? (count cases)) | |
(throw (IllegalArgumentException. "cond-let requires an odd number of forms"))) | |
(if (empty? cases) | |
nil | |
`(if-let [~name ~(first cases)] | |
~(second cases) | |
(cond-let ~name ~@(drop 2 cases))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment