Function: -reduce

-reduce is a byte-compiled function defined in dash.el.

Signature

(-reduce FN LIST)

Documentation

Reduce the function FN across LIST.

Return the result of applying FN to the first two elements of LIST, then applying FN to that result and the third element, etc. If LIST contains a single element, return it without calling FN. If LIST is empty, return the result of calling FN with no arguments.

This function's anaphoric counterpart is --reduce.

For other folds, see also -reduce-from and -reduce-r.

View in manual

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defun -reduce (fn list)
  "Reduce the function FN across LIST.
Return the result of applying FN to the first two elements of
LIST, then applying FN to that result and the third element, etc.
If LIST contains a single element, return it without calling FN.
If LIST is empty, return the result of calling FN with no
arguments.

This function's anaphoric counterpart is `--reduce'.

For other folds, see also `-reduce-from' and `-reduce-r'."
  (declare (important-return-value t))
  (if list
      (-reduce-from fn (car list) (cdr list))
    (funcall fn)))