Function: --reduce
--reduce is a macro defined in dash.el.
Signature
(--reduce FORM LIST)
Documentation
Accumulate a value by evaluating FORM across LIST.
This macro is like --reduce-from (which see), except the first
element of LIST is taken as INIT. Thus if LIST contains a single
item, it is returned without evaluating FORM. If LIST is empty,
FORM is evaluated with it and acc bound to nil.
This is the anaphoric counterpart to -reduce.
Source Code
;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defmacro --reduce (form list)
"Accumulate a value by evaluating FORM across LIST.
This macro is like `--reduce-from' (which see), except the first
element of LIST is taken as INIT. Thus if LIST contains a single
item, it is returned without evaluating FORM. If LIST is empty,
FORM is evaluated with `it' and `acc' bound to nil.
This is the anaphoric counterpart to `-reduce'."
(declare (debug (form form)))
(let ((lv (make-symbol "list-value")))
`(let ((,lv ,list))
(if ,lv
(--reduce-from ,form (car ,lv) (cdr ,lv))
;; Explicit nil binding pacifies lexical "variable left uninitialized"
;; warning. See issue #377 and upstream https://bugs.gnu.org/47080.
(let ((acc nil) (it nil))
(ignore acc it)
,form)))))