fold_list function
The steps of fold: every partial result, starting from the first value.
How to write it
fold_list(f, start, list)
- f
- A function of two arguments. Takes a function.
- start
- The first value. Takes an expression.
- list
- The elements to combine. Takes a list.
Examples
fold_list(plus, 0, [1, 2, 3])In the solver,
Open in the solverfold_list(plus, 0, [1, 2, 3])gives[0, 1, 3, 6].
Related functions
- fold
Combine the elements of a list from the left with a function, starting from a value.
- list
A list of the arguments.
- nest_list
The steps of nest: the value after each application, starting from the first.
- head
The head of an expression: the name of the function it is a call of.
- intersection
The elements that are in every one of some lists.
- flatten
Nested lists flattened into one list.