Created
August 24, 2014 04:07
-
-
Save ideal-knee/d651f415d8f063cdcc6d 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 better-if-let | |
([bindings then] | |
`(better-if-let ~bindings ~then nil)) | |
([[form tst & rest-bindings] then else] | |
`(let [temp# ~tst] | |
(if temp# | |
(let [~form temp#] | |
~(if (seq rest-bindings) | |
`(better-if-let ~(vec rest-bindings) ~then ~else) | |
then)) | |
~else)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment