Function: --first

--first is a macro defined in dash.el.

Signature

(--first FORM LIST)

Documentation

Return the first item in LIST for which FORM evals to non-nil.

Return nil if no such element is found. Each element of LIST in turn is bound to it and its index within LIST to it-index before evaluating FORM. This is the anaphoric counterpart to -first.

Aliases

--find

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defmacro --first (form list)
  "Return the first item in LIST for which FORM evals to non-nil.
Return nil if no such element is found.
Each element of LIST in turn is bound to `it' and its index
within LIST to `it-index' before evaluating FORM.
This is the anaphoric counterpart to `-first'."
  (declare (debug (form form)))
  (let ((n (make-symbol "needle")))
    `(let (,n)
       (--each-while ,list (or (not ,form)
                               (ignore (setq ,n it))))
       ,n)))