trevorbaca / baca

Trevor Bača's Abjad library.
8 stars 3 forks source link

Refactor scoping / selection #13

Open trevorbaca opened 6 years ago

trevorbaca commented 6 years ago

Now:

maker(
    ('v1', [(29, 30), (34, 35), (37, 38), (40, 41), 44, 46, (50, 57)]),
    stirrings_still.trajectories('C', 0, -3),
    )

maker(
    ('v2', [(29, 30), (34, 35), (37, 38), (40, 41), 44, 46, (50, 57)]),
    stirrings_still.trajectories('C', -1, -2),
    )

maker(
    ('va', [(29, 30), (34, 35), (37, 38), (40, 41), 44, 46, (50, 57)]),
    stirrings_still.trajectories('C', -2, -1),
    )

maker(
    ('vc', [(29, 30), (34, 35), (37, 38), (40, 41), 44, 46, (50, 57)]),
    stirrings_still.trajectories('C', -3, 0),
    )

Better:

maker(
    [(29, 30), (34, 35), (37, 38), (40, 41), 44, 46, (50, 57)],
    baca.new(
        stirrings_still.trajectories('C', 0, -3),
        voice='v1',
        ),
    baca.new(
        stirrings_still.trajectories('C', -1, -2),
        voice='v2',
        ),
    baca.new(
        stirrings_still.trajectories('C', -2, -1),
        voice='va',
        ),
    baca.new(
        stirrings_still.trajectories('C', -3, 0),
        voice='vc',
        ),
    )

Best:

maker(
    [(29, 30), (34, 35), (37, 38), (40, 41), 44, 46, (50, 57)],
    baca.new(
        stirrings_still.trajectories('C', 0, -3),
        stirrings_still.trajectories('C', -1, -2),
        stirrings_still.trajectories('C', -2, -1),
        stirrings_still.trajectories('C', -3, 0),
        voice=baca.thread(['v1', 'v2', 'va', 'vc']),
        ),
    )

Integrate to Stirrings Still [B].

Now:

    baca.staff_position(
        0,
        selector=baca.leaves()[:3],
        ),
    baca.staff_position(
        1,
        selector=baca.leaves()[3:],
        ),

Better:

    baca.staff_position(
        [0, 1],
        selector=baca.leaves().partition_by_counts([3], overhang=True),
        ),

Integrate into Fabergé J.

trevorbaca commented 5 years ago

Still valid in October 2018.