Function: -reduce-r-from

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

Signature

(-reduce-r-from FN INIT LIST)

Documentation

Reduce the function FN across LIST in reverse, starting with INIT.

Return the result of applying FN to the last element of LIST and INIT, then applying FN to the second-to-last element and the previous result of FN, etc. That is, the first argument of FN is the current element, and its second argument the accumulated value. If LIST is empty, return INIT without calling FN.

This function is like -reduce-from but the operation associates from the right rather than left. In other words, it starts from the end of LIST and flips the arguments to FN. Conceptually, it is like replacing the conses in LIST with applications of FN, and its last link with INIT, and evaluating the resulting expression.

This function's anaphoric counterpart is --reduce-r-from.

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

View in manual

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defun -reduce-r-from (fn init list)
  "Reduce the function FN across LIST in reverse, starting with INIT.
Return the result of applying FN to the last element of LIST and
INIT, then applying FN to the second-to-last element and the
previous result of FN, etc.  That is, the first argument of FN is
the current element, and its second argument the accumulated
value.  If LIST is empty, return INIT without calling FN.

This function is like `-reduce-from' but the operation associates
from the right rather than left.  In other words, it starts from
the end of LIST and flips the arguments to FN.  Conceptually, it
is like replacing the conses in LIST with applications of FN, and
its last link with INIT, and evaluating the resulting expression.

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

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