updated names + snapshot
This commit is contained in:
parent
f5c4373f99
commit
addb6db1c7
2 changed files with 68 additions and 9 deletions
|
|
@ -2408,9 +2408,9 @@ export const applyN = register('applyN', function (n, func, p) {
|
|||
});
|
||||
|
||||
/**
|
||||
* The plyWithClassic function repeats each event the given number of times, applying the given function to each event.\n
|
||||
* Here the function does not take the iteration index as an argument.
|
||||
* @name plyWithClassic
|
||||
* The plyWith function repeats each event the given number of times, applying the given function to each event.\n
|
||||
* @name plyWith
|
||||
* @synonyms plywith
|
||||
* @param {number} factor how many times to repeat
|
||||
* @param {function} func function to apply, given the pattern
|
||||
* @example
|
||||
|
|
@ -2418,7 +2418,7 @@ export const applyN = register('applyN', function (n, func, p) {
|
|||
* .plyWith(4, (p) => p.add(2))
|
||||
* .scale("C:minor").note()
|
||||
*/
|
||||
export const plyWithClassic = register('plyWithClassic', function (factor, func, pat) {
|
||||
export const plyWith = register(['plyWith', 'plywith'], function (factor, func, pat) {
|
||||
const result = pat
|
||||
.fmap((x) => cat(...listRange(0, factor - 1).map((i) => applyN(i, func, x)))._fast(factor))
|
||||
.squeezeJoin();
|
||||
|
|
@ -2429,17 +2429,18 @@ export const plyWithClassic = register('plyWithClassic', function (factor, func,
|
|||
});
|
||||
|
||||
/**
|
||||
* The plyWith function repeats each event the given number of times, applying the given function to each event.
|
||||
* @name plyWith
|
||||
* @synonyms plywith
|
||||
* The plyForEach function repeats each event the given number of times, applying the given function to each event.
|
||||
* This version of ply uses the iteration index as an argument to the function, similar to echoWith.
|
||||
* @name plyForEach
|
||||
* @synonyms plyforeach
|
||||
* @param {number} factor how many times to repeat
|
||||
* @param {function} func function to apply, given the pattern and the iteration index
|
||||
* @example
|
||||
* "<0 [2 4]>"
|
||||
* .plyWith(4, (p,n) => p.add(n*2))
|
||||
* .plyForEach(4, (p,n) => p.add(n*2))
|
||||
* .scale("C:minor").note()
|
||||
*/
|
||||
export const plyWith = register(['plyWith', 'plywith'], function (factor, func, pat) {
|
||||
export const plyForEach = register(['plyForEach', 'plyforeach'], function (factor, func, pat) {
|
||||
const result = pat
|
||||
.fmap((x) => cat(cat(pure(x), ...listRange(1, factor - 1).map((i) => func(pure(x), i))))._fast(factor))
|
||||
.squeezeJoin();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue