when-some

macrosince v0.0-2261imported clojure.core/when-someEdit
(when-some bindings & body)

Details:

When test is not nil, evaluates body with x bound to the value of test.


See Also:


Source docstring:
bindings => binding-form test

When test is not nil, evaluates body with binding-form bound to the
value of test
Source code @ clojure:src/clj/clojure/core.clj
(defmacro when-some
  {: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)))))