I feel like with pair of macros if
and cond
we miss companion macro for if-let
:
(defmacro cond-let
[& clauses]
(when clauses
(if (next clauses)
(list 'if-let (first clauses)
(second clauses)
(cons 'cond-let (nnext clauses)))
(first clauses))))
(cond-let [a nil] {:a a}
[b false] {:b b}
:default)
I did not find if this variation of cond-let
(without introducing much new syntax) macro were discussed in the past but generally it looks like natural for clolure.core.