mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 13:48:34 +00:00
squeezeBind itself + tidying
This commit is contained in:
parent
8ea59067ce
commit
529d448383
@ -583,7 +583,7 @@ class Pattern {
|
||||
return this.innerBind(id);
|
||||
}
|
||||
|
||||
squeezeJoin() {
|
||||
_squeezeJoin() {
|
||||
const pat_of_pats = this;
|
||||
function query(state) {
|
||||
const haps = pat_of_pats.query(state);
|
||||
@ -616,6 +616,10 @@ class Pattern {
|
||||
return new Pattern(query);
|
||||
}
|
||||
|
||||
_squeezeBind(func) {
|
||||
return this.fmap(func).squeezeBind();
|
||||
}
|
||||
|
||||
_apply(func) {
|
||||
return func(this);
|
||||
}
|
||||
@ -678,7 +682,7 @@ class Pattern {
|
||||
}
|
||||
|
||||
_ply(factor) {
|
||||
return this.fmap(x => pure(x)._fast(factor)).squeezeJoin()
|
||||
return this.fmap(x => pure(x)._fast(factor))._squeezeJoin()
|
||||
}
|
||||
|
||||
// cpm = cycles per minute
|
||||
|
||||
@ -491,10 +491,10 @@ describe('Pattern', function() {
|
||||
)
|
||||
})
|
||||
})
|
||||
describe("squeezeJoin", () => {
|
||||
describe("_squeezeJoin", () => {
|
||||
it("Can squeeze", () => {
|
||||
assert.deepStrictEqual(
|
||||
sequence("a", ["a","a"]).fmap(a => fastcat("b", "c")).squeezeJoin().firstCycle(),
|
||||
sequence("a", ["a","a"]).fmap(a => fastcat("b", "c"))._squeezeJoin().firstCycle(),
|
||||
sequence(["b", "c"],[["b", "c"],["b", "c"]]).firstCycle()
|
||||
)
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user