FoldList

FoldList[f,x,{a,b,}]
gives {x,f[x,a],f[f[x,a],b],}.

FoldList[f,{a,b,c,}]
gives {a,f[a,b],f[f[a,b],c],}.

FoldList[f]
represents an operator form of FoldList that can be applied to expressions.

DetailsDetails

ExamplesExamplesopen allclose all

Basic Examples  (6)Basic Examples  (6)

In[1]:=
Click for copyable input
Out[1]=

Cumulative sums of the elements of the list:

In[1]:=
Click for copyable input
Out[1]=

Cumulative powers:

In[1]:=
Click for copyable input
Out[1]=

Start from the first element of the list:

In[1]:=
Click for copyable input
Out[1]=

Use the operator form of FoldList on one argument:

In[1]:=
Click for copyable input
Out[1]=

Use the operator form of FoldList on two arguments:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 1991
(2.0)
| Updated in 2016
(11.0)
Translate this page: