FoldList
Every intermediate result of folding f over a list.
✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram Language
FoldList✓FoldList(f, x0, list) — one longer than .FoldList(f, list)like the 3-argument form, using the first element of as and folding over the rest.Typed signatures
| Type | Package | Applies |
|---|---|---|
((any, any) any -> any, any, collection<any>?) -> collection | combinatorics | always |
Details
- The last element equals Fold(, , ).
- See Accumulate for the common case .
Examples
Scope #
A lazy Range, not a materialised List -- see Length's own note on the same distinction
live ↗InOut
Known value · Hand-computed by iterated pairwise LCM of 2..10 (lcm(1,2)=2, lcm(2,3)=6, lcm(6,4)=12, ..., lcm(840,9)=2520, lcm(2520,10)=2520) -- an independent check that a lazy [[Range]] argument is walked element by element, not read off its own two constructor arguments (2 and 10)
live ↗
InOut
Possible issues #
About
| Examples | 31 |
|---|---|
| Checked against | Wolfram Language 31 agreemathlib4 7 agree1 error |
| Crosswalk | Wolfram Language |
Implementation
mapped
mathlib4packages/oracle/src/mappings.tsEvery partial fold from the seed, one longer than the list. The seedless two-argument form is not bound.
See also: Fold, Accumulate