store/[org.clojure/clojure "1.8.0"] clj::clojure.core/when-first

Official Documentation

Add notes
Arities
==================================================
   [bindings & body]

Docstring
==================================================
  bindings => x xs

  Roughly the same as (when (seq xs) (let [x (first xs)] body)) but xs is evaluated only once

Source

(defmacro when-first
  "bindings => x xs

  Roughly the same as (when (seq xs) (let [x (first xs)] body)) but xs is evaluated only once"
  {:added "1.0"}
  [bindings & body]
  (assert-args
     (vector? bindings) "a vector for its binding"
     (= 2 (count bindings)) "exactly 2 forms in binding vector")
  (let [[x xs] bindings]
    `(when-let [xs# (seq ~xs)]
       (let [~x (first xs#)]
           ~@body))))

Example 1

Edit
(when-first [a [1 2 3]] a)
;; => 1

(when-first [a []] a)
;; => nil

(when-first [a nil] a)
;; => nil

Uses on crossclj