Function: --filter

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

Signature

(--filter FORM LIST)

Documentation

Return a new list of the items in LIST for which FORM evals to non-nil.

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 -filter. For the opposite operation, see also --remove.

Aliases

--select

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defmacro --filter (form list)
  "Return a new list of the items in LIST for which FORM evals to non-nil.
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 `-filter'.
For the opposite operation, see also `--remove'."
  (declare (debug (form form)))
  (let ((r (make-symbol "result")))
    `(let (,r)
       (--each ,list (when ,form (push it ,r)))
       (nreverse ,r))))