Liking cljdoc? Tell your friends :D
All platforms.

com.wallbrew.spoon.core

General purpose utility functions.

General purpose utility functions.
raw docstring

when-let+clj/smacro

(when-let+ bindings & body)

A multiple bindings version of clojure.core/when-let. If all bindings evaluate truthy, the body will be evaluated in an implictit do in which all bindings are bound to the value of their test. If any binding evaluates falsey, the body will not be evaluated and nil will be returned. If multiple forms are provided, the last form will be returned.

Example:

(when-let+ 
  [a 1 b 2]
  (+ a b)) ; => 3

(when-let+ 
  [a nil b 2]
  (+ a b)) ; => nil
A multiple bindings version of `clojure.core/when-let`.
If all bindings evaluate truthy, the body will be evaluated in an implictit `do` in which all bindings are bound to the value of their test.
If any binding evaluates falsey, the body will not be evaluated and nil will be returned.
If multiple forms are provided, the last form will be returned.

Example:
```clj
(when-let+ 
  [a 1 b 2]
  (+ a b)) ; => 3

(when-let+ 
  [a nil b 2]
  (+ a b)) ; => nil
```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close