sequencetools.is_permutation

abjad.tools.sequencetools.is_permutation.is_permutation(expr, length=None)[source]

New in version 2.0.

True when expr is a permutation:

abjad> from abjad.tools import sequencetools
abjad> sequencetools.is_permutation([4, 5, 0, 3, 2, 1])
True

Otherwise false:

abjad> sequencetools.is_permutation([1, 1, 5, 3, 2, 1])
False

True when expr is a permutation of first length nonnegative integers:

abjad> sequencetools.is_permutation([4, 5, 0, 3, 2, 1], length = 6)
True

Otherwise false:

abjad> sequencetools.is_permutation([4, 0, 3, 2, 1], length = 6)
False

Return boolean.

This Page