From 36a456eeb4ffe40063f5ffbbbd86c0fff55f2686 Mon Sep 17 00:00:00 2001 From: tyow Date: Sat, 28 Feb 2026 14:43:04 -0500 Subject: [PATCH] Update replicate and extend examples to show difference --- packages/core/pattern.mjs | 9 +++------ test/__snapshots__/examples.test.mjs.snap | 10 +++++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index f88c4159a..594aab7a8 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -3396,7 +3396,7 @@ export const drop = stepRegister('drop', function (i, pat) { * @tags stepwise * @example * stepcat( - * sound("bd bd - cp").extend(2), + * sound("bd bd - ").extend(2), * sound("bd - sd -") * ).pace(8) */ @@ -3407,15 +3407,12 @@ export const extend = stepRegister('extend', function (factor, pat) { /** * *Experimental* * - * `replicate` is similar to `fast` in that it increases its density, but it also increases the step count - * accordingly. So `stepcat("a b".replicate(2), "c d")` would be the same as `"a b a b c d"`, whereas - * `stepcat("a b".fast(2), "c d")` would be the same as `"[a b] [a b] c d"`. + * `replicate` is similar to `extend`, except that `replicate` will "replicate" the thing being extended. This will only differ from `extend` when the input pattern differs from cycle to cycle. * - * TODO: find out how this function differs from extend * @tags stepwise * @example * stepcat( - * sound("bd bd - cp").replicate(2), + * sound("bd bd - ").replicate(2), * sound("bd - sd -") * ).pace(8) */ diff --git a/test/__snapshots__/examples.test.mjs.snap b/test/__snapshots__/examples.test.mjs.snap index 551f80cd0..dbf94bf76 100644 --- a/test/__snapshots__/examples.test.mjs.snap +++ b/test/__snapshots__/examples.test.mjs.snap @@ -4371,7 +4371,7 @@ exports[`runs examples > example "extend" example index 0 1`] = ` "[ 3/8 → 1/2 | s:cp ]", "[ 1/2 → 5/8 | s:bd ]", "[ 5/8 → 3/4 | s:bd ]", - "[ 7/8 → 1/1 | s:cp ]", + "[ 7/8 → 1/1 | s:hh ]", "[ 1/1 → 9/8 | s:bd ]", "[ 5/4 → 11/8 | s:sd ]", "[ 3/2 → 13/8 | s:bd ]", @@ -4379,7 +4379,7 @@ exports[`runs examples > example "extend" example index 0 1`] = ` "[ 15/8 → 2/1 | s:cp ]", "[ 2/1 → 17/8 | s:bd ]", "[ 17/8 → 9/4 | s:bd ]", - "[ 19/8 → 5/2 | s:cp ]", + "[ 19/8 → 5/2 | s:hh ]", "[ 5/2 → 21/8 | s:bd ]", "[ 11/4 → 23/8 | s:sd ]", "[ 3/1 → 25/8 | s:bd ]", @@ -4387,7 +4387,7 @@ exports[`runs examples > example "extend" example index 0 1`] = ` "[ 27/8 → 7/2 | s:cp ]", "[ 7/2 → 29/8 | s:bd ]", "[ 29/8 → 15/4 | s:bd ]", - "[ 31/8 → 4/1 | s:cp ]", + "[ 31/8 → 4/1 | s:hh ]", ] `; @@ -10148,10 +10148,10 @@ exports[`runs examples > example "replicate" example index 0 1`] = ` "[ 5/4 → 11/8 | s:sd ]", "[ 3/2 → 13/8 | s:bd ]", "[ 13/8 → 7/4 | s:bd ]", - "[ 15/8 → 2/1 | s:cp ]", + "[ 15/8 → 2/1 | s:hh ]", "[ 2/1 → 17/8 | s:bd ]", "[ 17/8 → 9/4 | s:bd ]", - "[ 19/8 → 5/2 | s:cp ]", + "[ 19/8 → 5/2 | s:hh ]", "[ 5/2 → 21/8 | s:bd ]", "[ 11/4 → 23/8 | s:sd ]", "[ 3/1 → 25/8 | s:bd ]",