Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit ad080d0

Browse files
authored
Merge pull request #1189 from kdiab/main
remove redundant example for cat, update snapshot
2 parents 2ffc6c9 + e9e7e02 commit ad080d0

File tree

3 files changed

+70
-95
lines changed

3 files changed

+70
-95
lines changed

packages/core/pattern.mjs

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -809,15 +809,6 @@ export class Pattern {
809809
//////////////////////////////////////////////////////////////////////
810810
// Multi-pattern functions
811811

812-
/**
813-
* Stacks the given pattern(s) to the current pattern.
814-
* @name stack
815-
* @memberof Pattern
816-
* @example
817-
* s("hh*4").stack(
818-
* note("c4(5,8)")
819-
* )
820-
*/
821812
stack(...pats) {
822813
return stack(this, ...pats);
823814
}
@@ -826,30 +817,9 @@ export class Pattern {
826817
return sequence(this, ...pats);
827818
}
828819

829-
/**
830-
* Appends the given pattern(s) to the current pattern.
831-
* @name seq
832-
* @memberof Pattern
833-
* @synonyms sequence, fastcat
834-
* @example
835-
* s("hh*4").seq(
836-
* note("c4(5,8)")
837-
* )
838-
*/
839820
seq(...pats) {
840821
return sequence(this, ...pats);
841822
}
842-
843-
/**
844-
* Appends the given pattern(s) to the next cycle.
845-
* @name cat
846-
* @memberof Pattern
847-
* @synonyms slowcat
848-
* @example
849-
* s("hh*4").cat(
850-
* note("c4(5,8)")
851-
* )
852-
*/
853823
cat(...pats) {
854824
return cat(this, ...pats);
855825
}
@@ -1280,6 +1250,12 @@ export function reify(thing) {
12801250
* @example
12811251
* stack("g3", "b3", ["e4", "d4"]).note()
12821252
* // "g3,b3,[e4,d4]".note()
1253+
*
1254+
* @example
1255+
* // As a chained function:
1256+
* s("hh*4").stack(
1257+
* note("c4(5,8)")
1258+
* )
12831259
*/
12841260
export function stack(...pats) {
12851261
// Array test here is to avoid infinite recursions..
@@ -1408,6 +1384,11 @@ export function slowcatPrime(...pats) {
14081384
* cat("e5", "b4", ["d5", "c5"]).note()
14091385
* // "<e5 b4 [d5 c5]>".note()
14101386
*
1387+
* @example
1388+
* // As a chained function:
1389+
* s("hh*4").cat(
1390+
* note("c4(5,8)")
1391+
* )
14111392
*/
14121393
export function cat(...pats) {
14131394
return slowcat(...pats);
@@ -1478,12 +1459,18 @@ export function sequence(...pats) {
14781459
}
14791460

14801461
/** Like **cat**, but the items are crammed into one cycle.
1481-
* @synonyms fastcat, sequence
1462+
* @synonyms sequence, fastcat
14821463
* @example
14831464
* seq("e5", "b4", ["d5", "c5"]).note()
14841465
* // "e5 b4 [d5 c5]".note()
14851466
*
1467+
* @example
1468+
* // As a chained function:
1469+
* s("hh*4").seq(
1470+
* note("c4(5,8)")
1471+
* )
14861472
*/
1473+
14871474
export function seq(...pats) {
14881475
return fastcat(...pats);
14891476
}

test/__snapshots__/examples.test.mjs.snap

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,16 @@ exports[`runs examples > example "brandBy" example index 0 1`] = `
13791379
`;
13801380

13811381
exports[`runs examples > example "cat" example index 0 1`] = `
1382+
[
1383+
"[ 0/1 → 1/1 | note:e5 ]",
1384+
"[ 1/1 → 2/1 | note:b4 ]",
1385+
"[ 2/1 → 5/2 | note:d5 ]",
1386+
"[ 5/2 → 3/1 | note:c5 ]",
1387+
"[ 3/1 → 4/1 | note:e5 ]",
1388+
]
1389+
`;
1390+
1391+
exports[`runs examples > example "cat" example index 1 1`] = `
13821392
[
13831393
"[ 0/1 → 1/4 | s:hh ]",
13841394
"[ 1/4 → 1/2 | s:hh ]",
@@ -1401,16 +1411,6 @@ exports[`runs examples > example "cat" example index 0 1`] = `
14011411
]
14021412
`;
14031413

1404-
exports[`runs examples > example "cat" example index 0 2`] = `
1405-
[
1406-
"[ 0/1 → 1/1 | note:e5 ]",
1407-
"[ 1/1 → 2/1 | note:b4 ]",
1408-
"[ 2/1 → 5/2 | note:d5 ]",
1409-
"[ 5/2 → 3/1 | note:c5 ]",
1410-
"[ 3/1 → 4/1 | note:e5 ]",
1411-
]
1412-
`;
1413-
14141414
exports[`runs examples > example "ceil" example index 0 1`] = `
14151415
[
14161416
"[ 0/1 → 1/4 | note:42 ]",
@@ -6976,6 +6976,27 @@ exports[`runs examples > example "segment" example index 0 1`] = `
69766976
`;
69776977

69786978
exports[`runs examples > example "seq" example index 0 1`] = `
6979+
[
6980+
"[ 0/1 → 1/3 | note:e5 ]",
6981+
"[ 1/3 → 2/3 | note:b4 ]",
6982+
"[ 2/3 → 5/6 | note:d5 ]",
6983+
"[ 5/6 → 1/1 | note:c5 ]",
6984+
"[ 1/1 → 4/3 | note:e5 ]",
6985+
"[ 4/3 → 5/3 | note:b4 ]",
6986+
"[ 5/3 → 11/6 | note:d5 ]",
6987+
"[ 11/6 → 2/1 | note:c5 ]",
6988+
"[ 2/1 → 7/3 | note:e5 ]",
6989+
"[ 7/3 → 8/3 | note:b4 ]",
6990+
"[ 8/3 → 17/6 | note:d5 ]",
6991+
"[ 17/6 → 3/1 | note:c5 ]",
6992+
"[ 3/1 → 10/3 | note:e5 ]",
6993+
"[ 10/3 → 11/3 | note:b4 ]",
6994+
"[ 11/3 → 23/6 | note:d5 ]",
6995+
"[ 23/6 → 4/1 | note:c5 ]",
6996+
]
6997+
`;
6998+
6999+
exports[`runs examples > example "seq" example index 1 1`] = `
69797000
[
69807001
"[ 0/1 → 1/8 | s:hh ]",
69817002
"[ 1/8 → 1/4 | s:hh ]",
@@ -7016,27 +7037,6 @@ exports[`runs examples > example "seq" example index 0 1`] = `
70167037
]
70177038
`;
70187039

7019-
exports[`runs examples > example "seq" example index 0 2`] = `
7020-
[
7021-
"[ 0/1 → 1/3 | note:e5 ]",
7022-
"[ 1/3 → 2/3 | note:b4 ]",
7023-
"[ 2/3 → 5/6 | note:d5 ]",
7024-
"[ 5/6 → 1/1 | note:c5 ]",
7025-
"[ 1/1 → 4/3 | note:e5 ]",
7026-
"[ 4/3 → 5/3 | note:b4 ]",
7027-
"[ 5/3 → 11/6 | note:d5 ]",
7028-
"[ 11/6 → 2/1 | note:c5 ]",
7029-
"[ 2/1 → 7/3 | note:e5 ]",
7030-
"[ 7/3 → 8/3 | note:b4 ]",
7031-
"[ 8/3 → 17/6 | note:d5 ]",
7032-
"[ 17/6 → 3/1 | note:c5 ]",
7033-
"[ 3/1 → 10/3 | note:e5 ]",
7034-
"[ 10/3 → 11/3 | note:b4 ]",
7035-
"[ 11/3 → 23/6 | note:d5 ]",
7036-
"[ 23/6 → 4/1 | note:c5 ]",
7037-
]
7038-
`;
7039-
70407040
exports[`runs examples > example "seqPLoop" example index 0 1`] = `
70417041
[
70427042
"[ 0/1 → 1/8 | s:bd ]",
@@ -7730,6 +7730,27 @@ exports[`runs examples > example "squiz" example index 0 1`] = `
77307730
`;
77317731

77327732
exports[`runs examples > example "stack" example index 0 1`] = `
7733+
[
7734+
"[ 0/1 → 1/2 | note:e4 ]",
7735+
"[ 0/1 → 1/1 | note:g3 ]",
7736+
"[ 0/1 → 1/1 | note:b3 ]",
7737+
"[ 1/2 → 1/1 | note:d4 ]",
7738+
"[ 1/1 → 3/2 | note:e4 ]",
7739+
"[ 1/1 → 2/1 | note:g3 ]",
7740+
"[ 1/1 → 2/1 | note:b3 ]",
7741+
"[ 3/2 → 2/1 | note:d4 ]",
7742+
"[ 2/1 → 5/2 | note:e4 ]",
7743+
"[ 2/1 → 3/1 | note:g3 ]",
7744+
"[ 2/1 → 3/1 | note:b3 ]",
7745+
"[ 5/2 → 3/1 | note:d4 ]",
7746+
"[ 3/1 → 7/2 | note:e4 ]",
7747+
"[ 3/1 → 4/1 | note:g3 ]",
7748+
"[ 3/1 → 4/1 | note:b3 ]",
7749+
"[ 7/2 → 4/1 | note:d4 ]",
7750+
]
7751+
`;
7752+
7753+
exports[`runs examples > example "stack" example index 1 1`] = `
77337754
[
77347755
"[ 0/1 → 1/8 | note:c4 ]",
77357756
"[ 0/1 → 1/4 | s:hh ]",
@@ -7770,27 +7791,6 @@ exports[`runs examples > example "stack" example index 0 1`] = `
77707791
]
77717792
`;
77727793

7773-
exports[`runs examples > example "stack" example index 0 2`] = `
7774-
[
7775-
"[ 0/1 → 1/2 | note:e4 ]",
7776-
"[ 0/1 → 1/1 | note:g3 ]",
7777-
"[ 0/1 → 1/1 | note:b3 ]",
7778-
"[ 1/2 → 1/1 | note:d4 ]",
7779-
"[ 1/1 → 3/2 | note:e4 ]",
7780-
"[ 1/1 → 2/1 | note:g3 ]",
7781-
"[ 1/1 → 2/1 | note:b3 ]",
7782-
"[ 3/2 → 2/1 | note:d4 ]",
7783-
"[ 2/1 → 5/2 | note:e4 ]",
7784-
"[ 2/1 → 3/1 | note:g3 ]",
7785-
"[ 2/1 → 3/1 | note:b3 ]",
7786-
"[ 5/2 → 3/1 | note:d4 ]",
7787-
"[ 3/1 → 7/2 | note:e4 ]",
7788-
"[ 3/1 → 4/1 | note:g3 ]",
7789-
"[ 3/1 → 4/1 | note:b3 ]",
7790-
"[ 7/2 → 4/1 | note:d4 ]",
7791-
]
7792-
`;
7793-
77947794
exports[`runs examples > example "steps" example index 0 1`] = `
77957795
[
77967796
"[ 0/1 → 1/4 | s:bd ]",

website/src/pages/learn/factories.mdx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,14 @@ These are the equivalents used by the Mini Notation:
2525

2626
<JsDoc client:idle name="cat" h={0} />
2727

28-
You can also use cat as a chained function like this:
29-
30-
<JsDoc client:idle name="Pattern.cat" h={0} hideDescription />
31-
3228
## seq
3329

3430
<JsDoc client:idle name="seq" h={0} />
3531

36-
Or as a chained function:
37-
38-
<JsDoc client:idle name="Pattern.seq" h={0} hideDescription />
39-
4032
## stack
4133

4234
<JsDoc client:idle name="stack" h={0} />
4335

44-
As a chained function:
45-
46-
<JsDoc client:idle name="Pattern.stack" h={0} hideDescription />
47-
4836
## s_cat
4937

5038
<JsDoc client:idle name="s_cat" h={0} />

0 commit comments

Comments
 (0)