Function: reduce

reduce is a function alias for cl-reduce, defined in cl-seq.el.gz.

This function is obsolete since 27.1; use cl-reduce instead.

Signature

(reduce FUNCTION SEQ [KEYWORD VALUE]...)

Documentation

Reduce two-argument FUNCTION across SEQ.

Keywords supported: :start :end :from-end :initial-value :key

Return the result of calling FUNCTION with the first and the second element of SEQ, then calling FUNCTION with that result and the third element of SEQ, then with that result and the fourth element of SEQ, etc.

If :INITIAL-VALUE is specified, it is logically added to the front of SEQ (or the back if :FROM-END is non-nil). If SEQ is empty, return :INITIAL-VALUE and FUNCTION is not called.

If SEQ is empty and no :INITIAL-VALUE is specified, then return the result of calling FUNCTION with zero arguments. This is the only case where FUNCTION is called with fewer than two arguments.

If SEQ contains exactly one element and no :INITIAL-VALUE is specified, then return that element and FUNCTION is not called.

If :FROM-END is non-nil, the reduction occurs from the back of the SEQ moving forward, and the order of arguments to the FUNCTION is also reversed.

Aliases

reduce (obsolete since 27.1) org-reduce (obsolete since 9.0)