listtools.cumulative_sums — Abjad v1.1.1 documentation

### Navigation

- index
- modules |
- next |
- previous |
- Project Abjad »
- Abjad v1.1.1 documentation »
- Abjad API »

# listtools.cumulative_sums

`abjad.tools.listtools.` `cumulative_sums`(l)

  Return a list of the cumulative sums of the elements in l.

  Note

  `len(listtools.cumulative_sums(l)) == len(l)`.

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

      abjad> listtools.cumulative_sums([1, -2, 3, -4, 5, -6, 7, -8])
      [1, -1, 2, -2, 3, -3, 4, -4]

  Raise `TypeError` when l is neither list nor tuple:

      abjad> listtools.cumulative_sums('foo')
      TypeError

  Raise `ValueError` when l is empty:

      abjad> listtools.cumulative_sums([ ])
      ValueError

### Navigation

- index
- modules |
- next |
- previous |
- Project Abjad »
- Abjad v1.1.1 documentation »
- Abjad API »