Source: wikibot/fold-higher-order-function
= Fold (higher-order function)
{wiki=Fold_(higher-order_function)}
In functional programming, "fold" (also known as "reduce") is a higher-order function that processes a data structure (typically a list or array) by iteratively applying a function to an accumulator and each element of the structure. The goal of fold is to aggregate or build a single result from a collection of values.