listtools.cumulative_sums_zero

abjad.tools.listtools.cumulative_sums_zero(l)

Return a list of the cumulative sums of the elements in l, starting with 0.

Note

len(listtools.cumulative_sums_zero(l)) == len(l) + 1.

abjad> listtools.cumulative_sums_zero([1, 2, 3, 4, 5, 6, 7, 8])
[0, 1, 3, 6, 10, 15, 21, 28, 36]
abjad> listtools.cumulative_sums_zero([1, -2, 3, -4, 5, -6, 7, -8])
[0, 1, -1, 2, -2, 3, -3, 4, -4]

Raise ValueError when l is empty:

abjad> listtools.cumulative_sums_zero([ ])
ValueError

Previous topic

listtools.cumulative_sums

Next topic

listtools.cumulative_weights_signed

This Page