More experimental step functions: stepwax, stepwane, steptaper, steptour and taperlist (#1042)

* group tactus-oriented functions
* add stepwax, stepwane, steptaper and steptour
* taperlist
This commit is contained in:
Alex McLean 2024-04-08 09:46:18 +01:00 committed by GitHub
parent 558e9e36ff
commit ebeefc0ac4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 276 additions and 142 deletions

View file

@ -1138,4 +1138,28 @@ describe('Pattern', () => {
);
});
});
describe('steptaper', () => {
it('can taper', () => {
expect(sameFirst(sequence(0, 1, 2, 3, 4).steptaper(1, 5), sequence(0, 1, 2, 3, 4, 0, 1, 2, 3, 0, 1, 2, 0, 1, 0)));
});
it('can taper backwards', () => {
expect(
sameFirst(sequence(0, 1, 2, 3, 4).steptaper(-1, 5), sequence(0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4)),
);
});
});
describe('wax and wane, left', () => {
it('can wax from the left', () => {
expect(sameFirst(sequence(0, 1, 2, 3, 4).stepwax(2), sequence(0, 1)));
});
it('can wane to the left', () => {
expect(sameFirst(sequence(0, 1, 2, 3, 4).stepwane(2), sequence(0, 1, 2)));
});
it('can wax from the right', () => {
expect(sameFirst(sequence(0, 1, 2, 3, 4).stepwax(-2), sequence(3, 4)));
});
it('can wane to the right', () => {
expect(sameFirst(sequence(0, 1, 2, 3, 4).stepwane(-2), sequence(2, 3, 4)));
});
});
});