FoldList
✖
FoldList
Details

- FoldList[Plus,0,list] generates cumulative sums of the elements in list.
- With a length n list, FoldList generates a list of length
. »
- The head of list in FoldList[f,x,list] need not be List.
- FoldList[f][list] is equivalent to FoldList[f,list].
- FoldList[f][x,list] is equivalent to FoldList[f,x,list].
Examples
open allclose allBasic Examples (6)Summary of the most common use cases

https://wolfram.com/xid/0j402qbe-g8k

Cumulative sums of the elements of the list:

https://wolfram.com/xid/0j402qbe-ri1


https://wolfram.com/xid/0j402qbe-tc7ck

Start from the first element of the list:

https://wolfram.com/xid/0j402qbe-v0moti

Use the operator form of FoldList on one argument:

https://wolfram.com/xid/0j402qbe-dnlw3m

Use the operator form of FoldList on two arguments:

https://wolfram.com/xid/0j402qbe-3ae10a

Scope (2)Survey of the scope of standard use cases
Generalizations & Extensions (2)Generalized and extended use cases
The head need not be List:

https://wolfram.com/xid/0j402qbe-i9t


https://wolfram.com/xid/0j402qbe-8qtyxu

Applications (15)Sample problems that can be solved with this function
Compute successive factorials:

https://wolfram.com/xid/0j402qbe-ldf

Compute products of successive primes:

https://wolfram.com/xid/0j402qbe-lmp


https://wolfram.com/xid/0j402qbe-ev657

Build up a continued fraction:

https://wolfram.com/xid/0j402qbe-vly

Build up a nested polynomial (Horner form):

https://wolfram.com/xid/0j402qbe-esv

Build up a number from digits:

https://wolfram.com/xid/0j402qbe-db2


https://wolfram.com/xid/0j402qbe-sfz


https://wolfram.com/xid/0j402qbe-sl

Find the running maximum of a list:

https://wolfram.com/xid/0j402qbe-bhtpxq


https://wolfram.com/xid/0j402qbe-dgwlrd

Find successively deeper parts in an expression:

https://wolfram.com/xid/0j402qbe-sso


https://wolfram.com/xid/0j402qbe-vgp

Successively append to a list:

https://wolfram.com/xid/0j402qbe-rpc


https://wolfram.com/xid/0j402qbe-ccb

Build up a left-branching binary tree:

https://wolfram.com/xid/0j402qbe-mo1


https://wolfram.com/xid/0j402qbe-v25

Compute a power using a power tree with successive squaring:

https://wolfram.com/xid/0j402qbe-npo


https://wolfram.com/xid/0j402qbe-f3i7w2

Properties & Relations (5)Properties of the function, and connections to other functions
FoldList makes a list of length :

https://wolfram.com/xid/0j402qbe-jio

Rest gives a result of length :

https://wolfram.com/xid/0j402qbe-dgk

Folding with an empty list does not apply the function at all:

https://wolfram.com/xid/0j402qbe-jw6zn8

Fold gives the last element of FoldList:

https://wolfram.com/xid/0j402qbe-c0mp20


https://wolfram.com/xid/0j402qbe-8c5kr1

Functions that ignore their second argument give the same result as in NestList:

https://wolfram.com/xid/0j402qbe-dxf


https://wolfram.com/xid/0j402qbe-d1ubqk

Accumulate is equivalent to FoldList with Plus:

https://wolfram.com/xid/0j402qbe-gl7yhr


https://wolfram.com/xid/0j402qbe-b6msdp

Possible Issues (1)Common pitfalls and unexpected behavior
Wolfram Research (1991), FoldList, Wolfram Language function, https://reference.wolfram.com/language/ref/FoldList.html (updated 2016).
Text
Wolfram Research (1991), FoldList, Wolfram Language function, https://reference.wolfram.com/language/ref/FoldList.html (updated 2016).
Wolfram Research (1991), FoldList, Wolfram Language function, https://reference.wolfram.com/language/ref/FoldList.html (updated 2016).
CMS
Wolfram Language. 1991. "FoldList." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/FoldList.html.
Wolfram Language. 1991. "FoldList." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/FoldList.html.
APA
Wolfram Language. (1991). FoldList. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FoldList.html
Wolfram Language. (1991). FoldList. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FoldList.html
BibTeX
@misc{reference.wolfram_2025_foldlist, author="Wolfram Research", title="{FoldList}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/FoldList.html}", note=[Accessed: 26-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_foldlist, organization={Wolfram Research}, title={FoldList}, year={2016}, url={https://reference.wolfram.com/language/ref/FoldList.html}, note=[Accessed: 26-April-2025
]}