Function: --reduce-from

--reduce-from is a macro defined in dash.el.

Signature

(--reduce-from FORM INIT LIST)

Documentation

Accumulate a value by evaluating FORM across LIST.

This macro is like --each (which see), but it additionally provides an accumulator variable acc which it successively binds to the result of evaluating FORM for the current LIST element before processing the next element. For the first element, acc is initialized with the result of evaluating INIT. The return value is the resulting value of acc. If LIST is empty, FORM is not evaluated, and the return value is the result of INIT. This is the anaphoric counterpart to -reduce-from.

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defmacro --reduce-from (form init list)
  "Accumulate a value by evaluating FORM across LIST.
This macro is like `--each' (which see), but it additionally
provides an accumulator variable `acc' which it successively
binds to the result of evaluating FORM for the current LIST
element before processing the next element.  For the first
element, `acc' is initialized with the result of evaluating INIT.
The return value is the resulting value of `acc'.  If LIST is
empty, FORM is not evaluated, and the return value is the result
of INIT.
This is the anaphoric counterpart to `-reduce-from'."
  (declare (debug (form form form)))
  `(let ((acc ,init))
     (--each ,list (setq acc ,form))
     acc))