discombobulator 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -1
- package/src/articulation.mjs +5 -2
- package/src/articulationset.mjs +6 -3
- package/src/chord.mjs +4 -1
- package/src/cross.mjs +8 -2
- package/src/element.mjs +4 -1
- package/src/group.mjs +5 -2
- package/src/groupset.mjs +10 -4
- package/src/instrument.mjs +5 -2
- package/src/instrumentset.mjs +4 -1
- package/src/irregulargroupset.mjs +6 -3
- package/src/note.mjs +7 -4
- package/src/noteset.mjs +4 -1
- package/src/pattern.mjs +4 -1
- package/src/patternset.mjs +4 -1
- package/src/patternsource.mjs +4 -1
- package/src/regulargroupset.mjs +6 -3
- package/src/schedule.mjs +6 -3
- package/src/schema.mjs +4 -1
- package/src/set.mjs +49 -19
- package/src/test/articulation.mjs +66 -0
- package/src/test/articulationset.mjs +43 -0
- package/src/test/binaryoperator.mjs +210 -0
- package/src/test/chord.mjs +292 -0
- package/src/test/concolour.mjs +70 -0
- package/src/test/difference.mjs +492 -0
- package/src/test/element.mjs +66 -0
- package/src/test/group.mjs +79 -0
- package/src/test/groupset.mjs +43 -0
- package/src/test/instrument.mjs +66 -0
- package/src/test/instrumentset.mjs +43 -0
- package/src/test/intersection.mjs +493 -0
- package/src/test/irregulargroupset.mjs +461 -0
- package/src/test/note.mjs +367 -0
- package/src/test/noteset.mjs +43 -0
- package/src/test/operator.mjs +63 -0
- package/src/test/pattern.mjs +113 -0
- package/src/test/patternset.mjs +43 -0
- package/src/test/patternsource.mjs +43 -0
- package/src/test/regulargroupset.mjs +290 -0
- package/src/test/repl.mjs +68 -0
- package/src/test/replinit.mjs +142 -0
- package/src/test/rotation.mjs +753 -0
- package/src/test/schedule.mjs +275 -0
- package/src/test/schema.mjs +333 -0
- package/src/test/set.mjs +1081 -0
- package/src/test/symmetricdifference.mjs +495 -0
- package/src/test/test.mjs +208 -0
- package/src/test/testing.mjs +63 -0
- package/src/test/union.mjs +495 -0
- package/src/util-adapter.mjs +553 -9
package/package.json
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "discombobulator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "Discombobulator core library",
|
|
5
|
+
"homepage": "https://github.com/MarkPWebb/discombobulator#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/MarkPWebb/discombobulator/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/MarkPWebb/discombobulator.git"
|
|
12
|
+
},
|
|
5
13
|
"license": "ISC",
|
|
6
14
|
"author": "Mark Webb",
|
|
7
15
|
"type": "module",
|
package/src/articulation.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// An articulation is a modification to a note, such as an accent or roll.
|
|
4
4
|
|
|
5
5
|
// import util from "util";
|
|
6
|
-
import {
|
|
6
|
+
// import { _inspect } from "./util-adapter.mjs"; // From Disco App (base44)
|
|
7
7
|
|
|
8
8
|
import { Element } from "./element.mjs";
|
|
9
9
|
|
|
@@ -18,9 +18,12 @@ export class Articulation extends Element {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
get
|
|
21
|
+
get asString() {
|
|
22
22
|
return "Articulation";
|
|
23
23
|
}
|
|
24
|
+
get [Symbol.toStringTag]() {
|
|
25
|
+
return this.asString;
|
|
26
|
+
}
|
|
24
27
|
|
|
25
28
|
// [util.inspect.custom](depth, opts) {
|
|
26
29
|
[Symbol.for('nodejs.util.inspect.custom')](depth, opts) { // from Disco App (base44)
|
package/src/articulationset.mjs
CHANGED
|
@@ -7,14 +7,17 @@ import { Articulation } from './articulation.mjs'
|
|
|
7
7
|
|
|
8
8
|
export class ArticulationSet extends Set {
|
|
9
9
|
constructor(options = {}) {
|
|
10
|
-
|
|
10
|
+
super(options);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
get allowedElements() {
|
|
14
|
-
|
|
14
|
+
return [ Articulation ];
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
get asString() {
|
|
18
|
+
return "ArticulationSet";
|
|
19
|
+
}
|
|
17
20
|
get [Symbol.toStringTag]() {
|
|
18
|
-
|
|
21
|
+
return this.asString;
|
|
19
22
|
}
|
|
20
23
|
}
|
package/src/chord.mjs
CHANGED
|
@@ -13,9 +13,12 @@ export class Chord extends PatternSource {
|
|
|
13
13
|
super({ ...options, strict: false });
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
get
|
|
16
|
+
get asString() {
|
|
17
17
|
return "Chord";
|
|
18
18
|
}
|
|
19
|
+
get [Symbol.toStringTag]() {
|
|
20
|
+
return this.asString;
|
|
21
|
+
}
|
|
19
22
|
|
|
20
23
|
// Utility method to represent a chord for display, diagnostic and comparison purposes.
|
|
21
24
|
static summarise(chord) {
|
package/src/cross.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { Pattern } from './pattern.mjs'
|
|
|
12
12
|
import { PatternSet } from './patternset.mjs'
|
|
13
13
|
|
|
14
14
|
// Cross (Cartesian Product): All pairs of elements innerElement2-element setfrom two sets.
|
|
15
|
-
export class Cross extends Set.
|
|
15
|
+
export class Cross extends Set.BinaryOperator {
|
|
16
16
|
// Map cross parameter types (sets) to a resultant set type that Cross acts as
|
|
17
17
|
// a proxy for. Entries in the map have the following fields:
|
|
18
18
|
// a: first set argument type in the cross.
|
|
@@ -83,15 +83,21 @@ export class Cross extends Set.Operator {
|
|
|
83
83
|
return this.#proxyfor;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
get
|
|
86
|
+
get asString() {
|
|
87
87
|
return `Cross (${this.#proxyfor.name})`;
|
|
88
88
|
}
|
|
89
|
+
get [Symbol.toStringTag]() {
|
|
90
|
+
return this.asString;
|
|
91
|
+
}
|
|
89
92
|
|
|
90
93
|
*[Symbol.iterator]() {
|
|
91
94
|
let element = this.#allowed[0];
|
|
92
95
|
let outer = this.elements[0];
|
|
93
96
|
let inner = this.elements[1];
|
|
94
97
|
|
|
98
|
+
console.log(inner);
|
|
99
|
+
console.log(outer);
|
|
100
|
+
|
|
95
101
|
for (let outerElement of outer) {
|
|
96
102
|
for (let innerElement of inner) {
|
|
97
103
|
yield new element({add: [ outerElement, innerElement ]});
|
package/src/element.mjs
CHANGED
package/src/group.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// A group is a time-axis pattern that specifies how chords may be grouped.
|
|
4
4
|
|
|
5
5
|
// import util from "util";
|
|
6
|
-
import {
|
|
6
|
+
// import { _inspect } from "./util-adapter.mjs"; // From Disco App (base44)
|
|
7
7
|
|
|
8
8
|
import { Element } from "./element.mjs";
|
|
9
9
|
|
|
@@ -29,9 +29,12 @@ export class Group extends Element {
|
|
|
29
29
|
this.#length = length;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
get
|
|
32
|
+
get asString() {
|
|
33
33
|
return "Group";
|
|
34
34
|
}
|
|
35
|
+
get [Symbol.toStringTag]() {
|
|
36
|
+
return this.asString;
|
|
37
|
+
}
|
|
35
38
|
|
|
36
39
|
get group() {
|
|
37
40
|
return this.#group;
|
package/src/groupset.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// permutating the group set with a pattern set.
|
|
5
5
|
|
|
6
6
|
// import util from "util";
|
|
7
|
-
import {
|
|
7
|
+
// import { _inspect } from "./util-adapter.mjs"; // From Disco App (base44)
|
|
8
8
|
|
|
9
9
|
import { bitCount, factorial } from "./util.mjs";
|
|
10
10
|
import { permutations, permutationIndexGenerator } from "./permute.mjs";
|
|
@@ -53,16 +53,19 @@ export class GroupSet extends Set {
|
|
|
53
53
|
this.#allowRepeats = options.allowRepeats;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
get
|
|
56
|
+
get asString() {
|
|
57
57
|
return "Permute";
|
|
58
58
|
}
|
|
59
|
+
get [Symbol.toStringTag]() {
|
|
60
|
+
return this.asString;
|
|
61
|
+
}
|
|
59
62
|
|
|
60
63
|
#describe() {
|
|
61
64
|
let description = "";
|
|
62
65
|
|
|
63
66
|
for (let pattern of this) {
|
|
64
67
|
// description += util.inspect(pattern);
|
|
65
|
-
description +=
|
|
68
|
+
description += pattern.asString; // from Disco App (base44)
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
return description;
|
|
@@ -248,9 +251,12 @@ export class GroupSet extends Set {
|
|
|
248
251
|
return [Group];
|
|
249
252
|
}
|
|
250
253
|
|
|
251
|
-
get
|
|
254
|
+
get asString() {
|
|
252
255
|
return "GroupSet";
|
|
253
256
|
}
|
|
257
|
+
get [Symbol.toStringTag]() {
|
|
258
|
+
return this.asString;
|
|
259
|
+
}
|
|
254
260
|
|
|
255
261
|
// Permute a Pattern, or each Pattern of a PatternSet, with each
|
|
256
262
|
// Group in this GroupSet to produce a new PatternSet.
|
package/src/instrument.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// An instrument is a playing surface that generates a note.
|
|
4
4
|
|
|
5
5
|
// import util from "util";
|
|
6
|
-
import {
|
|
6
|
+
// import { _inspect } from "./util-adapter.mjs"; // From Disco App (base44)
|
|
7
7
|
|
|
8
8
|
import { Element } from "./element.mjs";
|
|
9
9
|
|
|
@@ -18,9 +18,12 @@ export class Instrument extends Element {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
get
|
|
21
|
+
get asString() {
|
|
22
22
|
return "Instrument";
|
|
23
23
|
}
|
|
24
|
+
get [Symbol.toStringTag]() {
|
|
25
|
+
return this.asString;
|
|
26
|
+
}
|
|
24
27
|
|
|
25
28
|
// [util.inspect.custom](depth, opts) {
|
|
26
29
|
[Symbol.for('nodejs.util.inspect.custom')](depth, opts) { // from Disco App (base44)
|
package/src/instrumentset.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// are generated.
|
|
5
5
|
|
|
6
6
|
// import util from "util";
|
|
7
|
-
import {
|
|
7
|
+
// import { _inspect } from "./util-adapter.mjs"; // From Disco App (base44)
|
|
8
8
|
|
|
9
9
|
import { bitCount } from "./util.mjs";
|
|
10
10
|
import { combinations, ithBinaryCombination } from "./permute.mjs";
|
|
@@ -89,9 +89,12 @@ export class IrregularGroupSet extends RegularGroupSet {
|
|
|
89
89
|
return this.#reverseMax;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
get
|
|
92
|
+
get asString() {
|
|
93
93
|
return "IrregularGroupSet";
|
|
94
94
|
}
|
|
95
|
+
get [Symbol.toStringTag]() {
|
|
96
|
+
return this.asString;
|
|
97
|
+
}
|
|
95
98
|
|
|
96
99
|
#actualMax(length) {
|
|
97
100
|
return Math.max(
|
|
@@ -110,7 +113,7 @@ export class IrregularGroupSet extends RegularGroupSet {
|
|
|
110
113
|
|
|
111
114
|
for (const group of this) {
|
|
112
115
|
// groups += (groups.length == 0 ? "" : ", ") + util.inspect(group);
|
|
113
|
-
groups += (groups.length == 0 ? "" : ", ") +
|
|
116
|
+
groups += (groups.length == 0 ? "" : ", ") + group.asString;
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
return `${this[Symbol.toStringTag]} {[${groups}]}`;
|
package/src/note.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// A note is a tuple of an instrument and a set of articulations that affect how it's played.
|
|
4
4
|
|
|
5
5
|
// import util from "util";
|
|
6
|
-
import {
|
|
6
|
+
// import { _inspect } from "./util-adapter.mjs"; // From Disco App (base44)
|
|
7
7
|
|
|
8
8
|
import { Element } from "./element.mjs";
|
|
9
9
|
import { Instrument } from "./instrument.mjs";
|
|
@@ -54,9 +54,12 @@ export class Note extends Element {
|
|
|
54
54
|
return new this.constructor({ add: [ this.#instrument, articulations ]});
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
get
|
|
57
|
+
get asString() {
|
|
58
58
|
return "Note";
|
|
59
59
|
}
|
|
60
|
+
get [Symbol.toStringTag]() {
|
|
61
|
+
return this.asString;
|
|
62
|
+
}
|
|
60
63
|
|
|
61
64
|
// Pseudo-implementation to allow Note to act like a set of two elements.
|
|
62
65
|
elementAt(index = 0) {
|
|
@@ -92,10 +95,10 @@ export class Note extends Element {
|
|
|
92
95
|
[Symbol.for('nodejs.util.inspect.custom')](depth, opts) { // from Disco App (base44)
|
|
93
96
|
return `${this[Symbol.toStringTag]} {${
|
|
94
97
|
// !!this.#instrument ? util.inspect(this.#instrument) : "undefined"
|
|
95
|
-
!!this.#instrument ?
|
|
98
|
+
!!this.#instrument ? this.#instrument.asString : "undefined"
|
|
96
99
|
}, {${
|
|
97
100
|
// !!this.#articulations ? util.inspect(this.#articulations) : "undefined"
|
|
98
|
-
!!this.#articulations ?
|
|
101
|
+
!!this.#articulations ? this.#articulations.asString : "undefined"
|
|
99
102
|
}}}`;
|
|
100
103
|
}
|
|
101
104
|
|
package/src/noteset.mjs
CHANGED
|
@@ -11,9 +11,12 @@ export class NoteSet extends PatternSource {
|
|
|
11
11
|
super(options);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
get
|
|
14
|
+
get asString() {
|
|
15
15
|
return "NoteSet";
|
|
16
16
|
}
|
|
17
|
+
get [Symbol.toStringTag]() {
|
|
18
|
+
return this.asString;
|
|
19
|
+
}
|
|
17
20
|
|
|
18
21
|
toChord() {
|
|
19
22
|
return new Chord({add: this});
|
package/src/pattern.mjs
CHANGED
|
@@ -14,9 +14,12 @@ export class Pattern extends Set {
|
|
|
14
14
|
return [PatternSource];
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
get
|
|
17
|
+
get asString() {
|
|
18
18
|
return "Pattern";
|
|
19
19
|
}
|
|
20
|
+
get [Symbol.toStringTag]() {
|
|
21
|
+
return this.asString;
|
|
22
|
+
}
|
|
20
23
|
|
|
21
24
|
// Equality operator overide.
|
|
22
25
|
//
|
package/src/patternset.mjs
CHANGED
package/src/patternsource.mjs
CHANGED
package/src/regulargroupset.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// groups in a range determined by boundaries and a step rate.
|
|
3
3
|
|
|
4
4
|
// import util from "util";
|
|
5
|
-
import {
|
|
5
|
+
// import { _inspect } from "./util-adapter.mjs"; // From Disco App (base44)
|
|
6
6
|
|
|
7
7
|
import { bitCount } from "./util.mjs";
|
|
8
8
|
import { Group } from "./group.mjs";
|
|
@@ -74,9 +74,12 @@ export class RegularGroupSet extends GroupSet {
|
|
|
74
74
|
return this.#step;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
get
|
|
77
|
+
get asString() {
|
|
78
78
|
return "RegularGroupSet";
|
|
79
79
|
}
|
|
80
|
+
get [Symbol.toStringTag]() {
|
|
81
|
+
return this.asString;
|
|
82
|
+
}
|
|
80
83
|
|
|
81
84
|
// [util.inspect.custom](depth, opts) {
|
|
82
85
|
[Symbol.for('nodejs.util.inspect.custom')](depth, opts) { // from Disco App (base44)
|
|
@@ -84,7 +87,7 @@ export class RegularGroupSet extends GroupSet {
|
|
|
84
87
|
|
|
85
88
|
for (const group of this) {
|
|
86
89
|
// groups += (groups.length == 0 ? "" : ", ") + util.inspect(group);
|
|
87
|
-
groups += (groups.length == 0 ? "" : ", ") +
|
|
90
|
+
groups += (groups.length == 0 ? "" : ", ") + group.asString;
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
return `${this[Symbol.toStringTag]} {[${groups}]}`;
|
package/src/schedule.mjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// pattern.
|
|
9
9
|
|
|
10
10
|
// import util from "util";
|
|
11
|
-
import {
|
|
11
|
+
// import { _inspect } from "./util-adapter.mjs"; // From Disco App (base44)
|
|
12
12
|
|
|
13
13
|
import Fraction from "fraction.js"
|
|
14
14
|
|
|
@@ -36,16 +36,19 @@ export class Schedule extends Set {
|
|
|
36
36
|
return [ Pattern, PatternSet ];
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
get
|
|
39
|
+
get asString() {
|
|
40
40
|
return "Schedule";
|
|
41
41
|
}
|
|
42
|
+
get [Symbol.toStringTag]() {
|
|
43
|
+
return this.asString;
|
|
44
|
+
}
|
|
42
45
|
|
|
43
46
|
#describe() {
|
|
44
47
|
let description = "";
|
|
45
48
|
|
|
46
49
|
for (let patterns of this) {
|
|
47
50
|
// description += util.inspect(patterns);
|
|
48
|
-
description +=
|
|
51
|
+
description += patterns.asString; // from Disco App (base44)
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
return description;
|
package/src/schema.mjs
CHANGED
|
@@ -23,9 +23,12 @@ export class Schema extends Set {
|
|
|
23
23
|
return [ Schedule ];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
get
|
|
26
|
+
get asString() {
|
|
27
27
|
return "Schema";
|
|
28
28
|
}
|
|
29
|
+
get [Symbol.toStringTag]() {
|
|
30
|
+
return this.asString;
|
|
31
|
+
}
|
|
29
32
|
|
|
30
33
|
get timeSignature() {
|
|
31
34
|
return this.#timeSignature;
|
package/src/set.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Base class for sets and sequences.
|
|
4
4
|
|
|
5
5
|
// import util from "util";
|
|
6
|
-
import {
|
|
6
|
+
// import { _inspect } from "./util-adapter.mjs"; // From Disco App (base44)
|
|
7
7
|
|
|
8
8
|
import { Element } from "./element.mjs";
|
|
9
9
|
|
|
@@ -50,9 +50,12 @@ export class Set extends Element {
|
|
|
50
50
|
return this.#allowedElementTypes;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
get
|
|
53
|
+
get asString() {
|
|
54
54
|
return "Set";
|
|
55
55
|
}
|
|
56
|
+
get [Symbol.toStringTag]() {
|
|
57
|
+
return this.asString;
|
|
58
|
+
}
|
|
56
59
|
|
|
57
60
|
get isAbstract() {
|
|
58
61
|
return this.#isAbstract;
|
|
@@ -145,7 +148,7 @@ export class Set extends Element {
|
|
|
145
148
|
// [util.inspect.custom](depth, opts) {
|
|
146
149
|
[Symbol.for('nodejs.util.inspect.custom')](depth, opts) { // from Disco App (base44)
|
|
147
150
|
// return `${this[Symbol.toStringTag]} {${util.inspect(this.elements)}}`;
|
|
148
|
-
return `${this[Symbol.toStringTag]} {${
|
|
151
|
+
return `${this[Symbol.toStringTag]} {${this.elements.asString}}`; // from Disco App (base44)
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
// Set generator/iterator. By default, just enumerate the elements in the set.
|
|
@@ -209,18 +212,22 @@ export class Set extends Element {
|
|
|
209
212
|
return this.#setof;
|
|
210
213
|
}
|
|
211
214
|
|
|
212
|
-
get
|
|
215
|
+
get asString() {
|
|
213
216
|
return "SetOf";
|
|
214
217
|
}
|
|
218
|
+
get [Symbol.toStringTag]() {
|
|
219
|
+
return this.asString;
|
|
220
|
+
}
|
|
215
221
|
|
|
216
222
|
// [util.inspect.custom](depth, opts) {
|
|
217
223
|
// return `${this[Symbol.toStringTag]} {${util.inspect(this.#setof)}}`;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
224
|
+
[Symbol.for('nodejs.util.inspect.custom')](depth, opts) { // from Disco App (base44)
|
|
225
|
+
return `${this[Symbol.toStringTag]} {${this.#setof.asString}}`;
|
|
226
|
+
}
|
|
221
227
|
|
|
222
228
|
get name() {
|
|
223
|
-
return this[util.inspect.custom]();
|
|
229
|
+
// return this[util.inspect.custom]();
|
|
230
|
+
return this[inspect.custom](); // from Disco App (base44)
|
|
224
231
|
}
|
|
225
232
|
|
|
226
233
|
equals(other) {
|
|
@@ -366,7 +373,7 @@ export class Set extends Element {
|
|
|
366
373
|
}
|
|
367
374
|
}
|
|
368
375
|
} else {
|
|
369
|
-
throw new Error(
|
|
376
|
+
throw new Error(`Attempt to add incorrect element type to set: ${element}`);
|
|
370
377
|
}
|
|
371
378
|
} else {
|
|
372
379
|
this.internalAdd(promoted);
|
|
@@ -607,9 +614,12 @@ export class Set extends Element {
|
|
|
607
614
|
super(options);
|
|
608
615
|
}
|
|
609
616
|
|
|
610
|
-
get
|
|
617
|
+
get asString() {
|
|
611
618
|
return "Operator";
|
|
612
619
|
}
|
|
620
|
+
get [Symbol.toStringTag]() {
|
|
621
|
+
return this.asString;
|
|
622
|
+
}
|
|
613
623
|
|
|
614
624
|
get smallestSet() {
|
|
615
625
|
return this.elements[0].size <= this.elements[1].size ? 0 : 1;
|
|
@@ -619,7 +629,8 @@ export class Set extends Element {
|
|
|
619
629
|
let inspect = "";
|
|
620
630
|
|
|
621
631
|
for (let element of this) {
|
|
622
|
-
inspect += (inspect.length > 0 ? ", " : "") + util.inspect(element);
|
|
632
|
+
// inspect += (inspect.length > 0 ? ", " : "") + util.inspect(element);
|
|
633
|
+
inspect += (inspect.length > 0 ? ", " : "") + element.asString;
|
|
623
634
|
}
|
|
624
635
|
|
|
625
636
|
return inspect;
|
|
@@ -700,7 +711,7 @@ export class Set extends Element {
|
|
|
700
711
|
|
|
701
712
|
for (const element of this) {
|
|
702
713
|
// elements += (elements.length == 0 ? "" : ", ") + util.inspect(element);
|
|
703
|
-
elements += (elements.length == 0 ? "" : ", ") +
|
|
714
|
+
elements += (elements.length == 0 ? "" : ", ") + element.asString;
|
|
704
715
|
}
|
|
705
716
|
|
|
706
717
|
return `${this[Symbol.toStringTag]} {[${elements}]}`;
|
|
@@ -765,9 +776,12 @@ export class Set extends Element {
|
|
|
765
776
|
return this.elements[0].allowedElements;
|
|
766
777
|
}
|
|
767
778
|
|
|
768
|
-
get
|
|
779
|
+
get asString() {
|
|
769
780
|
return "BinaryOperator";
|
|
770
781
|
}
|
|
782
|
+
get [Symbol.toStringTag]() {
|
|
783
|
+
return this.asString;
|
|
784
|
+
}
|
|
771
785
|
|
|
772
786
|
get smallestSet() {
|
|
773
787
|
return this.elements[0].size <= this.elements[1].size ? 0 : 1;
|
|
@@ -777,7 +791,8 @@ export class Set extends Element {
|
|
|
777
791
|
let inspect = "";
|
|
778
792
|
|
|
779
793
|
for (let element of this) {
|
|
780
|
-
inspect += (inspect.length > 0 ? ", " : "") + util.inspect(element);
|
|
794
|
+
// inspect += (inspect.length > 0 ? ", " : "") + util.inspect(element);
|
|
795
|
+
inspect += (inspect.length > 0 ? ", " : "") + element.asString; // from Disco App (base44)
|
|
781
796
|
}
|
|
782
797
|
|
|
783
798
|
return inspect;
|
|
@@ -835,9 +850,12 @@ export class Set extends Element {
|
|
|
835
850
|
super(set1, set2, options);
|
|
836
851
|
}
|
|
837
852
|
|
|
838
|
-
get
|
|
853
|
+
get asString() {
|
|
839
854
|
return "Difference";
|
|
840
855
|
}
|
|
856
|
+
get [Symbol.toStringTag]() {
|
|
857
|
+
return this.asString;
|
|
858
|
+
}
|
|
841
859
|
|
|
842
860
|
*[Symbol.iterator]() {
|
|
843
861
|
for (let element of this.elements[0]) {
|
|
@@ -880,9 +898,12 @@ export class Set extends Element {
|
|
|
880
898
|
super(set1, set2, options);
|
|
881
899
|
}
|
|
882
900
|
|
|
883
|
-
get
|
|
901
|
+
get asString() {
|
|
884
902
|
return "Intersection";
|
|
885
903
|
}
|
|
904
|
+
get [Symbol.toStringTag]() {
|
|
905
|
+
return this.asString;
|
|
906
|
+
}
|
|
886
907
|
|
|
887
908
|
*[Symbol.iterator]() {
|
|
888
909
|
const smallestSet = this.smallestSet;
|
|
@@ -961,9 +982,12 @@ export class Set extends Element {
|
|
|
961
982
|
return this.#rotateLeft;
|
|
962
983
|
}
|
|
963
984
|
|
|
964
|
-
get
|
|
985
|
+
get asString() {
|
|
965
986
|
return "Rotation";
|
|
966
987
|
}
|
|
988
|
+
get [Symbol.toStringTag]() {
|
|
989
|
+
return this.asString;
|
|
990
|
+
}
|
|
967
991
|
|
|
968
992
|
*[Symbol.iterator]() {
|
|
969
993
|
const setSize = this.set.size;
|
|
@@ -1043,9 +1067,12 @@ export class Set extends Element {
|
|
|
1043
1067
|
super(set1, set2, options);
|
|
1044
1068
|
}
|
|
1045
1069
|
|
|
1046
|
-
get
|
|
1070
|
+
get asString() {
|
|
1047
1071
|
return "SymmetricDifference";
|
|
1048
1072
|
}
|
|
1073
|
+
get [Symbol.toStringTag]() {
|
|
1074
|
+
return this.asString;
|
|
1075
|
+
}
|
|
1049
1076
|
|
|
1050
1077
|
*[Symbol.iterator]() {
|
|
1051
1078
|
for (let element of this.elements[0]) {
|
|
@@ -1101,9 +1128,12 @@ export class Set extends Element {
|
|
|
1101
1128
|
super(set1, set2, options);
|
|
1102
1129
|
}
|
|
1103
1130
|
|
|
1104
|
-
get
|
|
1131
|
+
get asString() {
|
|
1105
1132
|
return "Union";
|
|
1106
1133
|
}
|
|
1134
|
+
get [Symbol.toStringTag]() {
|
|
1135
|
+
return this.asString;
|
|
1136
|
+
}
|
|
1107
1137
|
|
|
1108
1138
|
*[Symbol.iterator]() {
|
|
1109
1139
|
yield* this.elements[0];
|