(when-some bindings & body)
bindings => binding-form test
When test is not nil, evaluates body with binding-form bound to the
value of test
Source
(defmacro when-some
"bindings => binding-form test
When test is not nil, evaluates body with binding-form bound to the
value of test"
{:added "1.6"}
[bindings & body]
(assert-args
(vector? bindings) "a vector for its binding"
(= 2 (count bindings)) "exactly 2 forms in binding vector")
(let [form (bindings 0) tst (bindings 1)]
`(let [temp# ~tst]
(if (nil? temp#)
nil
(let [~form temp#]
~@body)))))