Skip to content

Commit

Permalink
add stepBind, and add toplevel aliases for this and other binds
Browse files Browse the repository at this point in the history
  • Loading branch information
yaxu committed Jan 14, 2025
1 parent c76c023 commit 14c78a6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/core/pattern.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,13 @@ export const struct = curry((a, b) => reify(b).struct(a));
export const superimpose = curry((a, b) => reify(b).superimpose(...a));
export const withValue = curry((a, b) => reify(b).withValue(a));

export const bind = curry((a, b) => reify(b).bind(a));
export const innerBind = curry((a, b) => reify(b).innerBind(a));
export const outerBind = curry((a, b) => reify(b).outerBind(a));
export const squeezeBind = curry((a, b) => reify(b).squeezeBind(a));
export const stepBind = curry((a, b) => reify(b).stepBind(a));
export const polyBind = curry((a, b) => reify(b).polyBind(a));

// operators
export const set = curry((a, b) => reify(b).set(a));
export const keep = curry((a, b) => reify(b).keep(a));
Expand Down Expand Up @@ -2540,6 +2547,10 @@ Pattern.prototype.stepJoin = function () {
return new Pattern(q, first_t);
};

Pattern.prototype.stepBind = function (func) {
return this.fmap(func).stepJoin();
};

export function _retime(timedHaps) {
const occupied_perc = timedHaps.filter((t, pat) => pat.hasTactus).reduce((a, b) => a.add(b), Fraction(0));
const occupied_tactus = removeUndefineds(timedHaps.map((t, pat) => pat.tactus)).reduce(
Expand Down

0 comments on commit 14c78a6

Please sign in to comment.