partition_sequence_by_restricted_growth_function

sequencetools.partition_sequence_by_restricted_growth_function(sequence, restricted_growth_function)

Partitions sequence by restricted_growth_function.

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

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

Returns list of lists.