Function: --each

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

Signature

(--each LIST &rest BODY)

Documentation

Evaluate BODY for each element of LIST and return nil.

Each element of LIST in turn is bound to it and its index within LIST to it-index before evaluating BODY. This is the anaphoric counterpart to -each.

Aliases

--each-indexed

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defmacro --each (list &rest body)
  "Evaluate BODY for each element of LIST and return nil.
Each element of LIST in turn is bound to `it' and its index
within LIST to `it-index' before evaluating BODY.
This is the anaphoric counterpart to `-each'."
  (declare (debug (form body)) (indent 1))
  (let ((l (make-symbol "list"))
        (i (make-symbol "i")))
    `(let ((,l ,list)
           (,i 0))
       (while ,l
         (let ((it (pop ,l)) (it-index ,i))
           (ignore it it-index)
           ,@body)
         (setq ,i (1+ ,i))))))