mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 05:38:34 +00:00
parent
6a1fa7e67f
commit
a189626e8b
@ -43,7 +43,7 @@ export class Pattern {
|
||||
constructor(query, tactus = undefined) {
|
||||
this.query = query;
|
||||
this._Pattern = true; // this property is used to detect if a pattern that fails instanceof Pattern is an instance of another Pattern
|
||||
this.__tactus = tactus; // in terms of number of beats per cycle
|
||||
this.__tactus = Fraction(tactus); // in terms of number of steps per cycle
|
||||
}
|
||||
|
||||
get tactus() {
|
||||
|
||||
@ -1146,7 +1146,7 @@ describe('Pattern', () => {
|
||||
expect(sameFirst(sequence(0, 1, 2, 3, 4).s_taper(-1, 5), sequence(0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4)));
|
||||
});
|
||||
});
|
||||
describe('s_add and s_sub, left', () => {
|
||||
describe('s_add and s_sub', () => {
|
||||
it('can add from the left', () => {
|
||||
expect(sameFirst(sequence(0, 1, 2, 3, 4).s_add(2), sequence(0, 1)));
|
||||
});
|
||||
@ -1159,5 +1159,14 @@ describe('Pattern', () => {
|
||||
it('can sub to the right', () => {
|
||||
expect(sameFirst(sequence(0, 1, 2, 3, 4).s_sub(-2), sequence(2, 3, 4)));
|
||||
});
|
||||
it('can subtract nothing', () => {
|
||||
expect(sameFirst(pure('a').s_sub(0), pure('a')));
|
||||
});
|
||||
it('can subtract nothing, repeatedly', () => {
|
||||
expect(sameFirst(pure('a').s_sub(0, 0), fastcat('a', 'a')));
|
||||
for (var i = 0; i < 100; ++i) {
|
||||
expect(sameFirst(pure('a').s_sub(...Array(i).fill(0)), fastcat(...Array(i).fill('a'))));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -319,9 +319,11 @@ export function uniqsort(a) {
|
||||
|
||||
// rational version
|
||||
export function uniqsortr(a) {
|
||||
return a.sort().filter(function (item, pos, ary) {
|
||||
return !pos || item.ne(ary[pos - 1]);
|
||||
});
|
||||
return a
|
||||
.sort((x, y) => x.compare(y))
|
||||
.filter(function (item, pos, ary) {
|
||||
return !pos || item.ne(ary[pos - 1]);
|
||||
});
|
||||
}
|
||||
|
||||
// code hashing helpers
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user