gives the list of successive xi obtained by applying f to pairs of the form {yi-1,ai}, where at each step f returns {xi,yi}.


gives the list of successive values of g[{xi,yi}].


is equivalent to FoldPairList[f,a0,{a1,a2,}].



open allclose all

Basic Examples  (7)

Partition a list into sublists of different lengths:

Break an amount of money into bills of given values:

Return both the quotients and the remainders at each step:

Scope  (2)

Use a list in the third argument:

Use an arbitrary head in the third argument:

By default, FoldPairList returns only the first elements of the pairs:

Use FoldPairList with fourth argument Last to get the second element of the successive pairs:

Generalizations & Extensions  (1)

Use Throw to exit a FoldPairList:

Applications  (2)

For each element of a list, return True if it is larger than all previous ones, and False otherwise:

A discrete-time state-space system is represented using a state equation and output equation . Simulate such a system to get the outputs :

Properties & Relations  (2)

Return the seed and all but the last elements of the third argument:

Return the list in the third argument:

FoldPairList returns one element less than FoldList:

Possible Issues  (2)

The function in the first argument of FoldPairList must return a pair of expressions:

FoldPairList[f,y0,{}] returns an empty list, with no last element:

Therefore FoldPair[f,y0,{}] stays unevaluated:

Introduced in 2015