Add someCycles and someCyclesBy
This commit is contained in:
parent
1274641f89
commit
1c3793e2ef
1 changed files with 18 additions and 0 deletions
|
|
@ -142,6 +142,24 @@ Pattern.prototype.sometimesPre = function (func) {
|
||||||
return this._sometimesByPre(0.5, func);
|
return this._sometimesByPre(0.5, func);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Pattern.prototype._someCyclesBy = function (x, func) {
|
||||||
|
return stack(
|
||||||
|
this._degradeByWith(rand._segment(1), x),
|
||||||
|
func(this._degradeByWith(rand.fmap((r) => 1 - r)._segment(1), 1 - x)),
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
Pattern.prototype.someCyclesBy = function (patx, func) {
|
||||||
|
const pat = this;
|
||||||
|
return reify(patx)
|
||||||
|
.fmap((x) => pat._someCyclesBy(x, func))
|
||||||
|
.innerJoin();
|
||||||
|
};
|
||||||
|
|
||||||
|
Pattern.prototype.someCycles = function (func) {
|
||||||
|
return this._someCyclesBy(0.5, func);
|
||||||
|
};
|
||||||
|
|
||||||
Pattern.prototype.often = function (func) {
|
Pattern.prototype.often = function (func) {
|
||||||
return this.sometimesBy(0.75, func);
|
return this.sometimesBy(0.75, func);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue