Skip to content

Commit d037d41

Browse files
committed
added recursive when-let that supports multiple bindings
1 parent 283604c commit d037d41

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src-clj/libmisc_clj/misc.clj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,10 @@
230230
(if (string? s)
231231
(-> s .trim .isEmpty not)
232232
false))
233+
234+
(defmacro ^:private when-let*
235+
([bindings & body]
236+
(if (seq bindings)
237+
`(when-let [~(first bindings) ~(second bindings)]
238+
(when-let* ~(drop 2 bindings) ~@body))
239+
`(do ~@body))))

0 commit comments

Comments
 (0)