Skip to content

FoldList

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

returns {x, f[x, a], f[f[x, a], b]}

Examples

A002110 Primorial numbers: product of first n primes.

>> FoldList(Times, 1, Prime(Range(20)))
{1,2,6,30,210,2310,30030,510510,9699690,223092870,6469693230,200560490130,
7420738134810,304250263527210,13082761331670030,614889782588491410,
32589158477190044730,1922760350154212639070,117288381359406970983270,
7858321551080267055879090,557940830126698960967415390}

Implementation status

  • ✅ - full supported

Github