listtools.cumulative_products

abjad.tools.listtools.cumulative_products(l)

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

abjad> listtools.cumulative_products([1, 2, 3, 4, 5, 6, 7, 8])
[1, 2, 6, 24, 120, 720, 5040, 40320]
abjad> listtools.cumulative_products([1, -2, 3, -4, 5, -6, 7, -8])
[1, -2, -6, 24, 120, -720, -5040, 40320]

Raise TypeError when l is neither list nor tuple:

abjad> mathtools.cumulative_products('foo')
TypeError

Raise ValueError when l is empty:

abjad> listtools.cumulative_products([ ])
ValueError

Previous topic

listtools.arithmetic_mean

Next topic

listtools.cumulative_sums

This Page