Beat-oriented functionality (#976)
* annotate pure values with their value, allowing single mininotation values to maintain their labels as pure * Don't use any 'patternified' arguments if they're all 'pure' * allow pattern weights (roughly, beats-per-cycle) to be inferred where possible, including from mininotation and across many transformations (e.g. `fast` with a 'pure' factor) * Add `beatCat`, similar to `timeCat` but funkier * `silence` has a weight of 1, add alternative `nothing` with a weight of 0, and `gap` function with weight argument * preserve weight across applicative operations (weight comes with the structure) * add `stack` alternatives that take advantage of pattern weights to align patterns differently - `stackLeft`, `stackRight`, `stackCentre`, `stackExpand`, with `stackBy` with an argument for patterning the alignment.
This commit is contained in:
parent
d102e1dbbc
commit
398533877c
8 changed files with 1391 additions and 1381 deletions
|
|
@ -51,6 +51,11 @@ Fraction.prototype.max = function (other) {
|
|||
return this.gt(other) ? this : other;
|
||||
};
|
||||
|
||||
Fraction.prototype.maximum = function (...others) {
|
||||
others = others.map((x) => new Fraction(x));
|
||||
return others.reduce((max, other) => other.max(max), this);
|
||||
};
|
||||
|
||||
Fraction.prototype.min = function (other) {
|
||||
return this.lt(other) ? this : other;
|
||||
};
|
||||
|
|
@ -83,6 +88,10 @@ export const gcd = (...fractions) => {
|
|||
return fractions.reduce((gcd, fraction) => gcd.gcd(fraction), fraction(1));
|
||||
};
|
||||
|
||||
export const lcm = (...fractions) => {
|
||||
return fractions.reduce((lcm, fraction) => lcm.lcm(fraction), fraction(1));
|
||||
};
|
||||
|
||||
fraction._original = Fraction;
|
||||
|
||||
export default fraction;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue