FoldList
FoldList[f, x,
a, b, ...
] gives
x, f[x, a], f[f[x, a], b], ...
.
Example: FoldList[f, x,
a, b, c
]
.
FoldList[Plus, 0, list] generates cumulative sums of the elements in list.
Example: FoldList[Plus, 0,
a, b, c
]
.
With a length
list, FoldList generates a list of length
.
The head of list in FoldList[f, x, list] need not be List.
See The Mathematica Book on the web: Section 2.2.2.
See also: Fold, NestList, ComposeList, Partition.
Further Examples