sequencetools.partition_sequence_by_restricted_growth_function

abjad.tools.sequencetools.partition_sequence_by_restricted_growth_function.partition_sequence_by_restricted_growth_function(sequence, restricted_growth_function)[source]

New in version 2.0.

Partition sequence by restricted_growth_function:

abjad> from abjad.tools import sequencetools
abjad> l = range(10)
abjad> rgf = [1, 1, 2, 2, 1, 2, 3, 3, 2, 4]
abjad> sequencetools.partition_sequence_by_restricted_growth_function(l, rgf)
[[0, 1, 4], [2, 3, 5, 8], [6, 7], [9]]

Raise value error when sequence length does not equal restricted_growth_function length.

Return list of lists.

This Page