def __init__(self, tokens=None, item_class=None, custom_identifier=None): from abjad.tools import pitchtools prototype = ( pitchtools.PitchClassSegment, pitchtools.PitchClassSet, pitchtools.PitchSegment, pitchtools.PitchSet, ) if isinstance(tokens, prototype): tokens = list(tokens) pairs = sequencetools.yield_all_unordered_pairs_of_sequence(tokens) tokens = [second - first for first, second in pairs] Set.__init__(self, tokens=tokens, item_class=item_class, custom_identifier=custom_identifier)
def __init__(self, items=None, item_class=None): from abjad.tools import pitchtools prototype = ( pitchtools.PitchClassSegment, pitchtools.PitchClassSet, pitchtools.PitchSegment, pitchtools.PitchSet, ) if isinstance(items, prototype): items = list(items) pairs = sequencetools.yield_all_unordered_pairs_of_sequence(items) items = [second - first for first, second in pairs] Set.__init__( self, items=items, item_class=item_class, )
def __init__(self, items=None, item_class=None): from abjad.tools import pitchtools prototype = ( pitchtools.PitchClassSegment, pitchtools.PitchClassSet, pitchtools.PitchSegment, pitchtools.PitchSet, ) if isinstance(items, prototype): items = list(items) pairs = sequencetools.yield_all_unordered_pairs_of_sequence( items) items = [second - first for first, second in pairs] Set.__init__( self, items=items, item_class=item_class, )
def __init__(self, items=None, item_class=None): import abjad prototype = ( abjad.PitchClassSegment, abjad.PitchClassSet, abjad.PitchSegment, abjad.PitchSet, ) if isinstance(items, prototype): items = list(items) enumerator = abjad.mathtools.Enumerator(items) pairs = enumerator.yield_pairs() items = [second - first for first, second in pairs] Set.__init__( self, items=items, item_class=item_class, )