functionalscript 0.0.288 → 0.0.292

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/README.md CHANGED
@@ -9,8 +9,6 @@ FunctionalScript is a pure functional programming language and a strict subset o
9
9
 
10
10
  Create a new FunctionalScript repository on GitHub [here](https://github.com/functionalscript/template/generate).
11
11
 
12
- Try FunctionalScript [here](https://functionalscript.com/).
13
-
14
12
  ## 1. Design Principles
15
13
 
16
14
  In FunctionalScript:
@@ -186,3 +184,56 @@ const f = x => {
186
184
  return r
187
185
  }
188
186
  ```
187
+
188
+ ## 5. Statements
189
+
190
+ `{ A_LIST_OF_STATEMENTS }` is one or many statements seperated by the newline control character. One of these statements mentioned earlier was [definition](#25-Definitions), also known as a [const](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const) statement. The other statements are described below.
191
+
192
+ ### 5.1 Let
193
+
194
+ [Let](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let) declares a local mutable alias for immutable objects. For example
195
+
196
+ ```js
197
+ let x = [5]
198
+ // you can assign another immutable object to the alias at any time.
199
+ x = [3, 4]
200
+ //but you can't change the properties of the immutable object.
201
+ x[0] = 3 // < invalid
202
+ //let aliases can not be referenced from another arrow function.
203
+ const f = () => x // < invalid
204
+ ```
205
+
206
+
207
+
208
+ This mutable object cannot be used in [closures](https://en.wikipedia.org/wiki/Closure_(computer_programming)) or nested functions.
209
+
210
+ An example of incorrect code would look like this:
211
+
212
+ ```js
213
+ let x = 5
214
+ const f = () => x
215
+ ```
216
+
217
+ ### 5.2 Return
218
+
219
+ [Return](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return)
220
+
221
+ ### 5.3 If...Else
222
+
223
+ [If...Else](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else)
224
+
225
+ ### 5.4 Switch
226
+
227
+ [Switch](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch)
228
+
229
+ ### 5.5 Throw
230
+
231
+ [Throw](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw). FunctionalScript allows to throw exceptions but it doesn't catch them. You should only be using Statement throw in non-recoverable situations. It could be compared to [panic in Rust](https://doc.rust-lang.org/std/macro.panic.html).
232
+
233
+ ### 5.6 While
234
+
235
+ [While](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while)
236
+
237
+ ### 5.7 Block
238
+
239
+ [Block](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/block)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.0.288",
3
+ "version": "0.0.292",
4
4
  "description": "FunctionalScript is a functional subset of JavaScript",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -79,14 +79,16 @@ Posible actions:
79
79
 
80
80
  ## Concat
81
81
 
82
- `concat` returns either `Branch1` or `Branch3`
82
+ `concat` accepts `left` and `right` branches of the same level.
83
83
 
84
- |`a` |`b` | |size |
85
- |------------------|-------------------|-------------------------------------------------|-----|
86
- |`[av]` |`[bv]` |`[[av,bv]]` | |
87
- | |`[bv0,bv1]` |`[a,bv0,[bv1]]` | |
88
- |`[av0,av1]` | |`[[av0],av1,b]` | |
89
- |`[...aHead,aLast]`|`[bFirst,...bLast]`|`up([...aHead,...concat(aLast,bFirst),...bTail])`|5..11|
84
+ |left |right |result |
85
+ |-------------|-------------|--------------------------|
86
+ |[an0] |[bn0] |[an0, value, r?] |
87
+ |[an0] |[bn0,bv1,bn2]|[an0, value, r?, bv1, bn2]|
88
+ |[an0,av1,an2]|[bn0] |[an0, av1, an2, value, r?]|
89
+
90
+ `popLeft` accepts `node` and returns
91
+ `value` and `['leaf', [] | Leaf1]` | `['branch', Branch1 | Branch3 | Branch5]`
90
92
 
91
93
  ## Up
92
94
 
@@ -118,12 +120,12 @@ Posible actions:
118
120
  | | | |`[[v1],v20,[v21]]` |
119
121
  | | |`[nR0]`|`[[nR0, v1, n20, v21, n22]]` |
120
122
  | | | |`[[nR0, v1, n20], v21, [n22, v23, n23]]`|
121
- | | |`nR` |`[r,v1,n2]` |
123
+ | | |`nR` |`[nR,v1,n2]` |
122
124
  | | 2|`[]` |`[[v00, v1]]` |
123
125
  | | | |`[[v00],v01,[v1]]` |
124
126
  | | |`[nR0]`|`[[n00, v01, n02, v1, nR0]]` |
125
127
  | | | |`[[n00, v01, n02], v02, [n03, v1, nR0]]`|
126
- | | |`nR` |`[n0,v1,r]` |
128
+ | | |`nR` |`[n0,v1,nR]` |
127
129
  |`[n0,v1,n2,v3,n4]`| 0|`[]` |`[[v1,v20],v3,n4]` |
128
130
  | | | |`[[v1],v20,[v21],v3,n4]` |
129
131
  | | |`[nR0]`|`[[nR0,v1,n20,v21,n22],v3,n4]` |
@@ -0,0 +1,165 @@
1
+ const _ = require('..')
2
+ const { todo } = require('../../../dev')
3
+ const cmp = require('../../function/compare')
4
+ const find = require('../find')
5
+ const list = require('../../list')
6
+ const array = require('../../array')
7
+
8
+ /**
9
+ * @template T
10
+ * @typedef {undefined | _.Leaf1<T>} Leaf01
11
+ */
12
+
13
+ /**
14
+ * @template T
15
+ * @typedef {{
16
+ * readonly first: Leaf01<T>,
17
+ * readonly tail: find.Path<T>
18
+ * }} RemovePath
19
+ */
20
+
21
+ /** @type {<T>(tail: find.Path<T>) => (n: _.Node<T>) => readonly[T, RemovePath<T>]} */
22
+ const path = tail => n => {
23
+ switch (n.length) {
24
+ case 1: { return [n[0], { first: undefined, tail }] }
25
+ case 2: { return [n[0], { first: [n[1]], tail }] }
26
+ case 3: { return path({ first: [0, n], tail })(n[0]) }
27
+ case 5: { return path({ first: [0, n], tail })(n[0]) }
28
+ }
29
+ }
30
+
31
+ /**
32
+ * @template T
33
+ * @typedef {_.Branch1<T> | _.Branch3<T> | _.Branch5<T>} Branch
34
+ */
35
+
36
+ /** @type {<T>(a: Branch<T>) => (n: _.Branch3<T>) => _.Branch1<T> | _.Branch3<T>} */
37
+ const reduceValue0 = a => n => {
38
+ const [, v1, n2] = n
39
+ if (a.length === 1) {
40
+ switch (n2.length) {
41
+ case 3: { return [[a[0], v1, ...n2]] }
42
+ case 5: { return [[a[0], v1, n2[0]], n2[1], [n2[2], n2[3], n2[4]]] }
43
+ default: { throw 'invalid node' }
44
+ }
45
+ } else {
46
+ return [a, v1, n2]
47
+ }
48
+ }
49
+
50
+ /** @type {<T>(a: Branch<T>) => (n: _.Branch3<T>) => _.Branch1<T> | _.Branch3<T>} */
51
+ const reduceValue2 = a => n => {
52
+ const [n0, v1, ] = n
53
+ if (a.length === 1) {
54
+ switch (n0.length) {
55
+ case 3: { return [[...n0, v1, a[0]]] }
56
+ case 5: { return [[n0[0], n0[1], n0[2]], n0[3], [n0[4], v1, a[0]]] }
57
+ default: { throw 'invalid node' }
58
+ }
59
+ } else {
60
+ return [n0, v1, a]
61
+ }
62
+ }
63
+
64
+ /** @type {<T>(a: Leaf01<T>) => (n: _.Branch3<T>) => _.Branch1<T> | _.Branch3<T>} */
65
+ const initValue0 = a => n => {
66
+ const [, v1, n2] = n
67
+ if (a === undefined) {
68
+ switch (n2.length) {
69
+ case 1: { return [[v1, ...n2]] }
70
+ case 2: { return [[v1], n2[0], [n2[1]]] }
71
+ default: { throw 'invalid node' }
72
+ }
73
+ } else {
74
+ return [a, v1, n2]
75
+ }
76
+ }
77
+
78
+ /** @type {<T>(a: Leaf01<T>) => (n: _.Branch3<T>) => _.Branch1<T> | _.Branch3<T>} */
79
+ const initValue1 = a => n => {
80
+ const [n0, v1] = n
81
+ if (a === undefined) {
82
+ switch (n0.length) {
83
+ case 1: { return [[...n0, v1]] }
84
+ case 2: { return [[n0[0]], n0[1], [v1]] }
85
+ default: { throw 'invalid node' }
86
+ }
87
+ } else { return [n0, v1, a] }
88
+ }
89
+
90
+ /**
91
+ * @template A,T
92
+ * @typedef {(a: A) => (n: _.Branch3<T>) => _.Branch1<T> | _.Branch3<T>} Merge
93
+ */
94
+
95
+ /** @type {<A, T>(ms: array.Array2<Merge<A, T>>) => (a: A) => (i: find.PathItem<T>) => Branch<T>} */
96
+ const reduceX = ms => a => i => {
97
+ const [m0, m2] = ms
98
+ /** @typedef {typeof ms extends array.Array2<Merge<infer A, infer T>> ? [A,T] : never} AT */
99
+ /** @typedef {AT[0]} A */
100
+ /** @typedef {AT[1]} T */
101
+ /** @type {(m: Merge<A, T>) => Branch<T>} */
102
+ const f = m => {
103
+ const n = i[1]
104
+ const ra = m(a)
105
+ return n.length === 3 ? ra(n) : [...ra([n[0], n[1], n[2]]), n[3], n[4]]
106
+ }
107
+ switch (i[0]) {
108
+ case 0: { return f(m0) }
109
+ case 2: { return f(m2) }
110
+ case 4: {
111
+ const n = i[1]
112
+ return [n[0], n[1], ...m2(a)([n[2], n[3], n[4]])]
113
+ }
114
+ }
115
+ }
116
+
117
+ const reduce = list.reduce(reduceX([reduceValue0, reduceValue2]))
118
+
119
+ const initReduce = reduceX([initValue0, initValue1])
120
+
121
+ /** @type {<T>(c: cmp.Compare<T>) => (node: _.Node<T>) => undefined | _.Node<T>} */
122
+ const remove = c => node => {
123
+ /** @typedef {typeof c extends cmp.Compare<infer T> ? T : never} T */
124
+ /** @type {() => undefined | RemovePath<T>} */
125
+ const f = () => {
126
+ const { first, tail } = find.find(c)(node)
127
+ /** @type {(n: _.Node<T>) => (f: (v: T) => find.PathItem<T>) => RemovePath<T>} */
128
+ const branch = n => f => {
129
+ const [v, p] = path(/** @type {find.Path<T>} */(undefined))(n)
130
+ return { first: p.first, tail: list.concat(p.tail)({ first: f(v), tail }) }
131
+ }
132
+ switch (first[0]) {
133
+ case 1: {
134
+ const n = first[1]
135
+ switch (n.length) {
136
+ case 1: { return { first: undefined, tail } }
137
+ case 2: { return { first: [n[1]], tail } }
138
+ case 3: { return branch(n[2])(v => [2, [n[0], v, n[2]]]) }
139
+ case 5: { return branch(n[2])(v => [2, [n[0], v, n[2], n[3], n[4]]]) }
140
+ }
141
+ }
142
+ case 3: {
143
+ const n = first[1]
144
+ switch (n.length) {
145
+ case 2: { return { first: [n[0]], tail } }
146
+ case 5: { return branch(n[4])(v => [4, [n[0], n[1], n[2], v, n[4]]]) }
147
+ }
148
+ }
149
+ default: { return undefined }
150
+ }
151
+ }
152
+ const r = f()
153
+ if (r === undefined) { return node }
154
+ const { first, tail } = r
155
+ const tailR = list.next(tail)
156
+ if (tailR === undefined) { return first }
157
+ const { first: tf, tail: tt } = tailR
158
+ const result = reduce(initReduce(first)(tf))(tt)
159
+ return result.length === 1 ? result[0] : result
160
+ }
161
+
162
+ module.exports = {
163
+ /** @readonly */
164
+ remove,
165
+ }
@@ -0,0 +1,409 @@
1
+ const _ = require('.')
2
+ const btree = require('..')
3
+ const s = require('../set')
4
+ const { stringCmp } = require('../../function/compare')
5
+ const json = require('../../../json')
6
+ const { sort } = require('../../object')
7
+
8
+ /** @type {(node: btree.Node<string>) => (value: string) => btree.Node<string>} */
9
+ const set = node => value => s.set(stringCmp(value))(value)(node)
10
+
11
+ /** @type {(node: btree.Node<string>) => (value: string) => btree.Node<string> | undefined} */
12
+ const remove = node => value => _.remove(stringCmp(value))(node)
13
+
14
+ const jsonStr = json.stringify(sort)
15
+
16
+ {
17
+ /** @type {btree.Node<string> | undefined} */
18
+ let _map = ['1']
19
+ for (let i = 2; i <= 38; i++)
20
+ _map = set(_map)((i * i).toString())
21
+ {
22
+ const r = jsonStr(_map)
23
+ if (r !==
24
+ '[[[[["1"],"100",["1024"]],"1089",[["1156"],"121",["1225"]]],' +
25
+ '"1296",' +
26
+ '[[["1369"],"144",["1444"]],"16",[["169"],"196",["225"]]]],' +
27
+ '"25",' +
28
+ '[[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
29
+ '"49",' +
30
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"9",["900","961"]]]]]'
31
+ ) { throw r }
32
+ }
33
+ {
34
+ _map = remove(_map)("0")
35
+ if (_map === undefined) { throw 'undefined' }
36
+ const r = jsonStr(_map)
37
+ if (r !==
38
+ '[[[[["1"],"100",["1024"]],"1089",[["1156"],"121",["1225"]]],' +
39
+ '"1296",' +
40
+ '[[["1369"],"144",["1444"]],"16",[["169"],"196",["225"]]]],' +
41
+ '"25",' +
42
+ '[[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
43
+ '"49",' +
44
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"9",["900","961"]]]]]'
45
+ ) { throw r }
46
+ }
47
+ {
48
+ _map = remove(_map)("1")
49
+ if (_map === undefined) { throw 'undefined' }
50
+ const r = jsonStr(_map)
51
+ if (r !==
52
+ '[[[["100","1024"],"1089",["1156"],"121",["1225"]],"1296",[["1369"],"144",["1444"]],"16",[["169"],"196",["225"]]],' +
53
+ '"25",' +
54
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
55
+ '"49",' +
56
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"9",["900","961"]]]]'
57
+ ) { throw r }
58
+ }
59
+ {
60
+ _map = remove(_map)("4")
61
+ if (_map === undefined) { throw 'undefined' }
62
+ const r = jsonStr(_map)
63
+ if (r !==
64
+ '[[[["100","1024"],"1089",["1156"],"121",["1225"]],"1296",[["1369"],"144",["1444"]],"16",[["169"],"196",["225"]]],' +
65
+ '"25",' +
66
+ '[[["256"],"289",["324"]],"36",[["361"],"400",["441","484"]]],' +
67
+ '"49",' +
68
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"9",["900","961"]]]]'
69
+ ) { throw r }
70
+ }
71
+ {
72
+ _map = remove(_map)("9")
73
+ if (_map === undefined) { throw 'undefined' }
74
+ const r = jsonStr(_map)
75
+ if (r !==
76
+ '[[[["100","1024"],"1089",["1156"],"121",["1225"]],"1296",[["1369"],"144",["1444"]],"16",[["169"],"196",["225"]]],' +
77
+ '"25",' +
78
+ '[[["256"],"289",["324"]],"36",[["361"],"400",["441","484"]]],' +
79
+ '"49",' +
80
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"900",["961"]]]]'
81
+ ) { throw r }
82
+ }
83
+ {
84
+ _map = remove(_map)("16")
85
+ if (_map === undefined) { throw 'undefined' }
86
+ const r = jsonStr(_map)
87
+ if (r !==
88
+ '[[[["100","1024"],"1089",["1156"],"121",["1225"]],"1296",[["1369"],"144",["1444"],"169",["196","225"]]],' +
89
+ '"25",' +
90
+ '[[["256"],"289",["324"]],"36",[["361"],"400",["441","484"]]],' +
91
+ '"49",' +
92
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"900",["961"]]]]'
93
+ ) { throw r }
94
+ }
95
+ {
96
+ _map = remove(_map)("25")
97
+ if (_map === undefined) { throw 'undefined' }
98
+ const r = jsonStr(_map)
99
+ if (r !==
100
+ '[[[["100","1024"],"1089",["1156"],"121",["1225"]],"1296",[["1369"],"144",["1444"],"169",["196","225"]],"256",[["289","324"],"36",["361"],"400",["441","484"]]],' +
101
+ '"49",' +
102
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"900",["961"]]]]'
103
+ ) { throw r }
104
+ }
105
+ {
106
+ _map = remove(_map)("36")
107
+ if (_map === undefined) { throw 'undefined' }
108
+ const r = jsonStr(_map)
109
+ if (r !==
110
+ '[[[["100","1024"],"1089",["1156"],"121",["1225"]],"1296",[["1369"],"144",["1444"],"169",["196","225"]],"256",[["289"],"324",["361"],"400",["441","484"]]],' +
111
+ '"49",' +
112
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"900",["961"]]]]'
113
+ ) { throw r }
114
+ }
115
+ {
116
+ _map = remove(_map)("49")
117
+ if (_map === undefined) { throw 'undefined' }
118
+ const r = jsonStr(_map)
119
+ if (r !==
120
+ '[[[["100","1024"],"1089",["1156"],"121",["1225"]],"1296",[["1369"],"144",["1444"],"169",["196","225"]],"256",[["289"],"324",["361"],"400",["441","484"]]],' +
121
+ '"529",' +
122
+ '[[["576","625"],"64",["676"],"729",["784"]],"81",[["841"],"900",["961"]]]]'
123
+ ) { throw r }
124
+ }
125
+ {
126
+ _map = remove(_map)("64")
127
+ if (_map === undefined) { throw 'undefined' }
128
+ const r = jsonStr(_map)
129
+ if (r !==
130
+ '[[[["100","1024"],"1089",["1156"],"121",["1225"]],"1296",[["1369"],"144",["1444"],"169",["196","225"]],"256",[["289"],"324",["361"],"400",["441","484"]]],' +
131
+ '"529",' +
132
+ '[[["576"],"625",["676"],"729",["784"]],"81",[["841"],"900",["961"]]]]'
133
+ ) { throw r }
134
+ }
135
+ {
136
+ _map = remove(_map)("81")
137
+ if (_map === undefined) { throw 'undefined' }
138
+ const r = jsonStr(_map)
139
+ if (r !==
140
+ '[[[["100","1024"],"1089",["1156"],"121",["1225"]],"1296",[["1369"],"144",["1444"],"169",["196","225"]],"256",[["289"],"324",["361"],"400",["441","484"]]],' +
141
+ '"529",' +
142
+ '[[["576"],"625",["676"]],"729",[["784"],"841",["900","961"]]]]'
143
+ ) { throw r }
144
+ }
145
+ {
146
+ _map = remove(_map)("100")
147
+ if (_map === undefined) { throw 'undefined' }
148
+ const r = jsonStr(_map)
149
+ if (r !==
150
+ '[[[["1024"],"1089",["1156"],"121",["1225"]],"1296",[["1369"],"144",["1444"],"169",["196","225"]],"256",[["289"],"324",["361"],"400",["441","484"]]],' +
151
+ '"529",' +
152
+ '[[["576"],"625",["676"]],"729",[["784"],"841",["900","961"]]]]'
153
+ ) { throw r }
154
+ }
155
+ {
156
+ _map = remove(_map)("121")
157
+ if (_map === undefined) { throw 'undefined' }
158
+ const r = jsonStr(_map)
159
+ if (r !==
160
+ '[[[["1024"],"1089",["1156","1225"]],"1296",[["1369"],"144",["1444"],"169",["196","225"]],"256",[["289"],"324",["361"],"400",["441","484"]]],' +
161
+ '"529",' +
162
+ '[[["576"],"625",["676"]],"729",[["784"],"841",["900","961"]]]]'
163
+ ) { throw r }
164
+ }
165
+ {
166
+ _map = remove(_map)("144")
167
+ if (_map === undefined) { throw 'undefined' }
168
+ const r = jsonStr(_map)
169
+ if (r !==
170
+ '[[[["1024"],"1089",["1156","1225"]],"1296",[["1369","1444"],"169",["196","225"]],"256",[["289"],"324",["361"],"400",["441","484"]]],' +
171
+ '"529",' +
172
+ '[[["576"],"625",["676"]],"729",[["784"],"841",["900","961"]]]]'
173
+ ) { throw r }
174
+ }
175
+ {
176
+ _map = remove(_map)("169")
177
+ if (_map === undefined) { throw 'undefined' }
178
+ const r = jsonStr(_map)
179
+ if (r !==
180
+ '[[[["1024"],"1089",["1156","1225"]],"1296",[["1369","1444"],"196",["225"]],"256",[["289"],"324",["361"],"400",["441","484"]]],' +
181
+ '"529",' +
182
+ '[[["576"],"625",["676"]],"729",[["784"],"841",["900","961"]]]]'
183
+ ) { throw r }
184
+ }
185
+ {
186
+ _map = remove(_map)("196")
187
+ if (_map === undefined) { throw 'undefined' }
188
+ const r = jsonStr(_map)
189
+ if (r !==
190
+ '[[[["1024"],"1089",["1156","1225"]],"1296",[["1369"],"1444",["225"]],"256",[["289"],"324",["361"],"400",["441","484"]]],' +
191
+ '"529",' +
192
+ '[[["576"],"625",["676"]],"729",[["784"],"841",["900","961"]]]]'
193
+ ) { throw r }
194
+ }
195
+ {
196
+ _map = remove(_map)("225")
197
+ if (_map === undefined) { throw 'undefined' }
198
+ const r = jsonStr(_map)
199
+ if (r !==
200
+ '[[[["1024"],"1089",["1156","1225"],"1296",["1369","1444"]],"256",[["289"],"324",["361"],"400",["441","484"]]],' +
201
+ '"529",' +
202
+ '[[["576"],"625",["676"]],"729",[["784"],"841",["900","961"]]]]'
203
+ ) { throw r }
204
+ }
205
+ {
206
+ _map = remove(_map)("256")
207
+ if (_map === undefined) { throw 'undefined' }
208
+ const r = jsonStr(_map)
209
+ if (r !==
210
+ '[[[["1024"],"1089",["1156","1225"],"1296",["1369","1444"]],"289",[["324","361"],"400",["441","484"]]],' +
211
+ '"529",' +
212
+ '[[["576"],"625",["676"]],"729",[["784"],"841",["900","961"]]]]'
213
+ ) { throw r }
214
+ }
215
+ {
216
+ _map = remove(_map)("289")
217
+ if (_map === undefined) { throw 'undefined' }
218
+ const r = jsonStr(_map)
219
+ if (r !==
220
+ '[[[["1024"],"1089",["1156","1225"],"1296",["1369","1444"]],"324",[["361"],"400",["441","484"]]],' +
221
+ '"529",' +
222
+ '[[["576"],"625",["676"]],"729",[["784"],"841",["900","961"]]]]'
223
+ ) { throw r }
224
+ }
225
+ {
226
+ _map = remove(_map)("324")
227
+ if (_map === undefined) { throw 'undefined' }
228
+ const r = jsonStr(_map)
229
+ if (r !==
230
+ '[[[["1024"],"1089",["1156","1225"],"1296",["1369","1444"]],"361",[["400"],"441",["484"]]],' +
231
+ '"529",' +
232
+ '[[["576"],"625",["676"]],"729",[["784"],"841",["900","961"]]]]'
233
+ ) { throw r }
234
+ }
235
+ {
236
+ _map = remove(_map)("361")
237
+ if (_map === undefined) { throw 'undefined' }
238
+ const r = jsonStr(_map)
239
+ if (r !==
240
+ '[[[["1024"],"1089",["1156","1225"]],"1296",[["1369","1444"],"400",["441","484"]]],' +
241
+ '"529",' +
242
+ '[[["576"],"625",["676"]],"729",[["784"],"841",["900","961"]]]]'
243
+ ) { throw r }
244
+ }
245
+ {
246
+ _map = remove(_map)("400")
247
+ if (_map === undefined) { throw 'undefined' }
248
+ const r = jsonStr(_map)
249
+ if (r !==
250
+ '[[[["1024"],"1089",["1156","1225"]],"1296",[["1369","1444"],"441",["484"]]],' +
251
+ '"529",' +
252
+ '[[["576"],"625",["676"]],"729",[["784"],"841",["900","961"]]]]'
253
+ ) { throw r }
254
+ }
255
+ {
256
+ _map = remove(_map)("441")
257
+ if (_map === undefined) { throw 'undefined' }
258
+ const r = jsonStr(_map)
259
+ if (r !==
260
+ '[[[["1024"],"1089",["1156","1225"]],"1296",[["1369"],"1444",["484"]]],' +
261
+ '"529",' +
262
+ '[[["576"],"625",["676"]],"729",[["784"],"841",["900","961"]]]]'
263
+ ) { throw r }
264
+ }
265
+ {
266
+ _map = remove(_map)("484")
267
+ if (_map === undefined) { throw 'undefined' }
268
+ const r = jsonStr(_map)
269
+ if (r !==
270
+ '[[["1024"],"1089",["1156","1225"],"1296",["1369","1444"]],' +
271
+ '"529",' +
272
+ '[["576"],"625",["676"]],' +
273
+ '"729",' +
274
+ '[["784"],"841",["900","961"]]]'
275
+ ) { throw r }
276
+ }
277
+ {
278
+ _map = remove(_map)("529")
279
+ if (_map === undefined) { throw 'undefined' }
280
+ const r = jsonStr(_map)
281
+ if (r !==
282
+ '[[["1024"],"1089",["1156","1225"]],"1296",[["1369","1444"],"576",["625","676"]],' +
283
+ '"729",' +
284
+ '[["784"],"841",["900","961"]]]'
285
+ ) { throw r }
286
+ }
287
+ {
288
+ _map = remove(_map)("576")
289
+ if (_map === undefined) { throw 'undefined' }
290
+ const r = jsonStr(_map)
291
+ if (r !==
292
+ '[[["1024"],"1089",["1156","1225"]],"1296",[["1369","1444"],"625",["676"]],' +
293
+ '"729",' +
294
+ '[["784"],"841",["900","961"]]]'
295
+ ) { throw r }
296
+ }
297
+ {
298
+ _map = remove(_map)("625")
299
+ if (_map === undefined) { throw 'undefined' }
300
+ const r = jsonStr(_map)
301
+ if (r !==
302
+ '[[["1024"],"1089",["1156","1225"]],"1296",[["1369"],"1444",["676"]],' +
303
+ '"729",' +
304
+ '[["784"],"841",["900","961"]]]'
305
+ ) { throw r }
306
+ }
307
+ {
308
+ _map = remove(_map)("676")
309
+ if (_map === undefined) { throw 'undefined' }
310
+ const r = jsonStr(_map)
311
+ if (r !==
312
+ '[[["1024"],"1089",["1156","1225"],"1296",["1369","1444"]],' +
313
+ '"729",' +
314
+ '[["784"],"841",["900","961"]]]'
315
+ ) { throw r }
316
+ }
317
+ {
318
+ _map = remove(_map)("729")
319
+ if (_map === undefined) { throw 'undefined' }
320
+ const r = jsonStr(_map)
321
+ if (r !==
322
+ '[[["1024"],"1089",["1156","1225"],"1296",["1369","1444"]],' +
323
+ '"784",' +
324
+ '[["841"],"900",["961"]]]'
325
+ ) { throw r }
326
+ }
327
+ {
328
+ _map = remove(_map)("784")
329
+ if (_map === undefined) { throw 'undefined' }
330
+ const r = jsonStr(_map)
331
+ if (r !==
332
+ '[[["1024"],"1089",["1156","1225"]],"1296",[["1369","1444"],"841",["900","961"]]]'
333
+ ) { throw r }
334
+ }
335
+ {
336
+ _map = remove(_map)("841")
337
+ if (_map === undefined) { throw 'undefined' }
338
+ const r = jsonStr(_map)
339
+ if (r !==
340
+ '[[["1024"],"1089",["1156","1225"]],"1296",[["1369","1444"],"900",["961"]]]'
341
+ ) { throw r }
342
+ }
343
+ {
344
+ _map = remove(_map)("900")
345
+ if (_map === undefined) { throw 'undefined' }
346
+ const r = jsonStr(_map)
347
+ if (r !==
348
+ '[[["1024"],"1089",["1156","1225"]],"1296",[["1369"],"1444",["961"]]]'
349
+ ) { throw r }
350
+ }
351
+ {
352
+ _map = remove(_map)("961")
353
+ if (_map === undefined) { throw 'undefined' }
354
+ const r = jsonStr(_map)
355
+ if (r !==
356
+ '[["1024"],"1089",["1156","1225"],"1296",["1369","1444"]]'
357
+ ) { throw r }
358
+ }
359
+ {
360
+ _map = remove(_map)("1024")
361
+ if (_map === undefined) { throw 'undefined' }
362
+ const r = jsonStr(_map)
363
+ if (r !==
364
+ '[["1089"],"1156",["1225"],"1296",["1369","1444"]]'
365
+ ) { throw r }
366
+ }
367
+ {
368
+ _map = remove(_map)("1089")
369
+ if (_map === undefined) { throw 'undefined' }
370
+ const r = jsonStr(_map)
371
+ if (r !==
372
+ '[["1156","1225"],"1296",["1369","1444"]]'
373
+ ) { throw r }
374
+ }
375
+ {
376
+ _map = remove(_map)("1156")
377
+ if (_map === undefined) { throw 'undefined' }
378
+ const r = jsonStr(_map)
379
+ if (r !==
380
+ '[["1225"],"1296",["1369","1444"]]'
381
+ ) { throw r }
382
+ }
383
+ {
384
+ _map = remove(_map)("1225")
385
+ if (_map === undefined) { throw 'undefined' }
386
+ const r = jsonStr(_map)
387
+ if (r !==
388
+ '[["1296"],"1369",["1444"]]'
389
+ ) { throw r }
390
+ }
391
+ {
392
+ _map = remove(_map)("1296")
393
+ if (_map === undefined) { throw 'undefined' }
394
+ const r = jsonStr(_map)
395
+ if (r !==
396
+ '["1369","1444"]'
397
+ ) { throw r }
398
+ }
399
+ {
400
+ _map = remove(_map)("1369")
401
+ if (_map === undefined) { throw 'undefined' }
402
+ const r = jsonStr(_map)
403
+ if (r !== '["1444"]') { throw r }
404
+ }
405
+ {
406
+ _map = remove(_map)("1444")
407
+ if (_map !== undefined) { throw _map }
408
+ }
409
+ }
@@ -16,4 +16,364 @@ const jsonStr = json.stringify(sort)
16
16
  _map = set(_map)((i * i).toString())
17
17
  const r = jsonStr(_map)
18
18
  if (r !== '[[["1","100"],"16",["25","36"]],"4",[["49"],"64",["81","9"]]]') { throw r }
19
- }
19
+ }
20
+
21
+ {
22
+ /** @type {btree.Node<string>} */
23
+ let _map = ['1']
24
+ for (let i = 2; i <= 11; i++)
25
+ _map = set(_map)((i * i).toString())
26
+ const r = jsonStr(_map)
27
+ if (r !== '[[["1"],"100",["121"],"16",["25","36"]],"4",[["49"],"64",["81","9"]]]') { throw r }
28
+ }
29
+
30
+ {
31
+ /** @type {btree.Node<string>} */
32
+ let _map = ['1']
33
+ for (let i = 2; i <= 12; i++)
34
+ _map = set(_map)((i * i).toString())
35
+ const r = jsonStr(_map)
36
+ if (r !== '[[["1"],"100",["121","144"],"16",["25","36"]],"4",[["49"],"64",["81","9"]]]') { throw r }
37
+ }
38
+
39
+ {
40
+ /** @type {btree.Node<string>} */
41
+ let _map = ['1']
42
+ for (let i = 2; i <= 13; i++)
43
+ _map = set(_map)((i * i).toString())
44
+ const r = jsonStr(_map)
45
+ if (r !== '[[["1"],"100",["121","144"]],"16",[["169"],"25",["36"]],"4",[["49"],"64",["81","9"]]]') { throw r }
46
+ }
47
+
48
+ {
49
+ /** @type {btree.Node<string>} */
50
+ let _map = ['1']
51
+ for (let i = 2; i <= 14; i++)
52
+ _map = set(_map)((i * i).toString())
53
+ const r = jsonStr(_map)
54
+ if (r !== '[[["1"],"100",["121","144"]],"16",[["169","196"],"25",["36"]],"4",[["49"],"64",["81","9"]]]') { throw r }
55
+ }
56
+
57
+ {
58
+ /** @type {btree.Node<string>} */
59
+ let _map = ['1']
60
+ for (let i = 2; i <= 15; i++)
61
+ _map = set(_map)((i * i).toString())
62
+ const r = jsonStr(_map)
63
+ if (r !== '[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"],"25",["36"]],"4",[["49"],"64",["81","9"]]]') { throw r }
64
+ }
65
+
66
+ {
67
+ /** @type {btree.Node<string>} */
68
+ let _map = ['1']
69
+ for (let i = 2; i <= 16; i++)
70
+ _map = set(_map)((i * i).toString())
71
+ const r = jsonStr(_map)
72
+ if (r !== '[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"],"25",["256","36"]],"4",[["49"],"64",["81","9"]]]') { throw r }
73
+ }
74
+
75
+ {
76
+ /** @type {btree.Node<string>} */
77
+ let _map = ['1']
78
+ for (let i = 2; i <= 17; i++)
79
+ _map = set(_map)((i * i).toString())
80
+ const r = jsonStr(_map)
81
+ if (r !== '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],"25",[[["256"],"289",["36"]],"4",[["49"],"64",["81","9"]]]]') { throw r }
82
+ }
83
+
84
+ {
85
+ /** @type {btree.Node<string>} */
86
+ let _map = ['1']
87
+ for (let i = 2; i <= 18; i++)
88
+ _map = set(_map)((i * i).toString())
89
+ const r = jsonStr(_map)
90
+ if (r !==
91
+ '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],"25",[[["256"],"289",["324","36"]],"4",[["49"],"64",["81","9"]]]]'
92
+ ) { throw r }
93
+ }
94
+
95
+ {
96
+ /** @type {btree.Node<string>} */
97
+ let _map = ['1']
98
+ for (let i = 2; i <= 19; i++)
99
+ _map = set(_map)((i * i).toString())
100
+ const r = jsonStr(_map)
101
+ if (r !==
102
+ '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],"25",[[["256"],"289",["324"],"36",["361"]],"4",[["49"],"64",["81","9"]]]]'
103
+ ) { throw r }
104
+ }
105
+
106
+ {
107
+ /** @type {btree.Node<string>} */
108
+ let _map = ['1']
109
+ for (let i = 2; i <= 20; i++)
110
+ _map = set(_map)((i * i).toString())
111
+ const r = jsonStr(_map)
112
+ if (r !==
113
+ '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],' +
114
+ '"25",' +
115
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400","49"],"64",["81","9"]]]]'
116
+ ) { throw r }
117
+ }
118
+
119
+ {
120
+ /** @type {btree.Node<string>} */
121
+ let _map = ['1']
122
+ for (let i = 2; i <= 21; i++)
123
+ _map = set(_map)((i * i).toString())
124
+ const r = jsonStr(_map)
125
+ if (r !==
126
+ '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],' +
127
+ '"25",' +
128
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["49"],"64",["81","9"]]]]'
129
+ ) { throw r }
130
+ }
131
+
132
+ {
133
+ /** @type {btree.Node<string>} */
134
+ let _map = ['1']
135
+ for (let i = 2; i <= 22; i++)
136
+ _map = set(_map)((i * i).toString())
137
+ const r = jsonStr(_map)
138
+ if (r !==
139
+ '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],' +
140
+ '"25",' +
141
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484","49"],"64",["81","9"]]]]'
142
+ ) { throw r }
143
+ }
144
+
145
+ {
146
+ /** @type {btree.Node<string>} */
147
+ let _map = ['1']
148
+ for (let i = 2; i <= 23; i++)
149
+ _map = set(_map)((i * i).toString())
150
+ const r = jsonStr(_map)
151
+ if (r !==
152
+ '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],' +
153
+ '"25",' +
154
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]],"49",[["529"],"64",["81","9"]]]]'
155
+ ) { throw r }
156
+ }
157
+
158
+ {
159
+ /** @type {btree.Node<string>} */
160
+ let _map = ['1']
161
+ for (let i = 2; i <= 24; i++)
162
+ _map = set(_map)((i * i).toString())
163
+ const r = jsonStr(_map)
164
+ if (r !==
165
+ '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],' +
166
+ '"25",' +
167
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]],"49",[["529","576"],"64",["81","9"]]]]'
168
+ ) { throw r }
169
+ }
170
+
171
+ {
172
+ /** @type {btree.Node<string>} */
173
+ let _map = ['1']
174
+ for (let i = 2; i <= 25; i++)
175
+ _map = set(_map)((i * i).toString())
176
+ const r = jsonStr(_map)
177
+ if (r !==
178
+ '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],' +
179
+ '"25",' +
180
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]],"49",[["529"],"576",["625"],"64",["81","9"]]]]'
181
+ ) { throw r }
182
+ }
183
+
184
+ {
185
+ /** @type {btree.Node<string>} */
186
+ let _map = ['1']
187
+ for (let i = 2; i <= 26; i++)
188
+ _map = set(_map)((i * i).toString())
189
+ const r = jsonStr(_map)
190
+ if (r !==
191
+ '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],' +
192
+ '"25",' +
193
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
194
+ '"49",' +
195
+ '[[["529"],"576",["625"]],"64",[["676"],"81",["9"]]]]'
196
+ ) { throw r }
197
+ }
198
+
199
+ {
200
+ /** @type {btree.Node<string>} */
201
+ let _map = ['1']
202
+ for (let i = 2; i <= 27; i++)
203
+ _map = set(_map)((i * i).toString())
204
+ const r = jsonStr(_map)
205
+ if (r !==
206
+ '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],' +
207
+ '"25",' +
208
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
209
+ '"49",' +
210
+ '[[["529"],"576",["625"]],"64",[["676","729"],"81",["9"]]]]'
211
+ ) { throw r }
212
+ }
213
+
214
+ {
215
+ /** @type {btree.Node<string>} */
216
+ let _map = ['1']
217
+ for (let i = 2; i <= 28; i++)
218
+ _map = set(_map)((i * i).toString())
219
+ const r = jsonStr(_map)
220
+ if (r !==
221
+ '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],' +
222
+ '"25",' +
223
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
224
+ '"49",' +
225
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"],"81",["9"]]]]'
226
+ ) { throw r }
227
+ }
228
+
229
+ {
230
+ /** @type {btree.Node<string>} */
231
+ let _map = ['1']
232
+ for (let i = 2; i <= 29; i++)
233
+ _map = set(_map)((i * i).toString())
234
+ const r = jsonStr(_map)
235
+ if (r !==
236
+ '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],' +
237
+ '"25",' +
238
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
239
+ '"49",' +
240
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"],"81",["841","9"]]]]'
241
+ ) { throw r }
242
+ }
243
+
244
+ {
245
+ /** @type {btree.Node<string>} */
246
+ let _map = ['1']
247
+ for (let i = 2; i <= 30; i++)
248
+ _map = set(_map)((i * i).toString())
249
+ const r = jsonStr(_map)
250
+ if (r !==
251
+ '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],' +
252
+ '"25",' +
253
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
254
+ '"49",' +
255
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"9",["900"]]]]'
256
+ ) { throw r }
257
+ }
258
+
259
+ {
260
+ /** @type {btree.Node<string>} */
261
+ let _map = ['1']
262
+ for (let i = 2; i <= 31; i++)
263
+ _map = set(_map)((i * i).toString())
264
+ const r = jsonStr(_map)
265
+ if (r !==
266
+ '[[[["1"],"100",["121","144"]],"16",[["169"],"196",["225"]]],' +
267
+ '"25",' +
268
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
269
+ '"49",' +
270
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"9",["900","961"]]]]'
271
+ ) { throw r }
272
+ }
273
+
274
+ {
275
+ /** @type {btree.Node<string>} */
276
+ let _map = ['1']
277
+ for (let i = 2; i <= 32; i++)
278
+ _map = set(_map)((i * i).toString())
279
+ const r = jsonStr(_map)
280
+ if (r !==
281
+ '[[[["1"],"100",["1024"],"121",["144"]],"16",[["169"],"196",["225"]]],' +
282
+ '"25",' +
283
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
284
+ '"49",' +
285
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"9",["900","961"]]]]'
286
+ ) { throw r }
287
+ }
288
+
289
+ {
290
+ /** @type {btree.Node<string>} */
291
+ let _map = ['1']
292
+ for (let i = 2; i <= 33; i++)
293
+ _map = set(_map)((i * i).toString())
294
+ const r = jsonStr(_map)
295
+ if (r !==
296
+ '[[[["1"],"100",["1024","1089"],"121",["144"]],"16",[["169"],"196",["225"]]],' +
297
+ '"25",' +
298
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
299
+ '"49",' +
300
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"9",["900","961"]]]]'
301
+ ) { throw r }
302
+ }
303
+
304
+ {
305
+ /** @type {btree.Node<string>} */
306
+ let _map = ['1']
307
+ for (let i = 2; i <= 34; i++)
308
+ _map = set(_map)((i * i).toString())
309
+ const r = jsonStr(_map)
310
+ if (r !==
311
+ '[[[["1"],"100",["1024"]],"1089",[["1156"],"121",["144"]],"16",[["169"],"196",["225"]]],' +
312
+ '"25",' +
313
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
314
+ '"49",' +
315
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"9",["900","961"]]]]'
316
+ ) { throw r }
317
+ }
318
+
319
+ {
320
+ /** @type {btree.Node<string>} */
321
+ let _map = ['1']
322
+ for (let i = 2; i <= 35; i++)
323
+ _map = set(_map)((i * i).toString())
324
+ const r = jsonStr(_map)
325
+ if (r !==
326
+ '[[[["1"],"100",["1024"]],"1089",[["1156"],"121",["1225","144"]],"16",[["169"],"196",["225"]]],' +
327
+ '"25",' +
328
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
329
+ '"49",' +
330
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"9",["900","961"]]]]'
331
+ ) { throw r }
332
+ }
333
+
334
+ {
335
+ /** @type {btree.Node<string>} */
336
+ let _map = ['1']
337
+ for (let i = 2; i <= 36; i++)
338
+ _map = set(_map)((i * i).toString())
339
+ const r = jsonStr(_map)
340
+ if (r !==
341
+ '[[[["1"],"100",["1024"]],"1089",[["1156"],"121",["1225"],"1296",["144"]],"16",[["169"],"196",["225"]]],' +
342
+ '"25",' +
343
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
344
+ '"49",' +
345
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"9",["900","961"]]]]'
346
+ ) { throw r }
347
+ }
348
+
349
+ {
350
+ /** @type {btree.Node<string>} */
351
+ let _map = ['1']
352
+ for (let i = 2; i <= 37; i++)
353
+ _map = set(_map)((i * i).toString())
354
+ const r = jsonStr(_map)
355
+ if (r !==
356
+ '[[[["1"],"100",["1024"]],"1089",[["1156"],"121",["1225"],"1296",["1369","144"]],"16",[["169"],"196",["225"]]],' +
357
+ '"25",' +
358
+ '[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
359
+ '"49",' +
360
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"9",["900","961"]]]]'
361
+ ) { throw r }
362
+ }
363
+
364
+ {
365
+ /** @type {btree.Node<string>} */
366
+ let _map = ['1']
367
+ for (let i = 2; i <= 38; i++)
368
+ _map = set(_map)((i * i).toString())
369
+ const r = jsonStr(_map)
370
+ if (r !==
371
+ '[[[[["1"],"100",["1024"]],"1089",[["1156"],"121",["1225"]]],' +
372
+ '"1296",' +
373
+ '[[["1369"],"144",["1444"]],"16",[["169"],"196",["225"]]]],' +
374
+ '"25",' +
375
+ '[[[["256"],"289",["324"],"36",["361"]],"4",[["400"],"441",["484"]]],' +
376
+ '"49",' +
377
+ '[[["529"],"576",["625"]],"64",[["676"],"729",["784"]],"81",[["841"],"9",["900","961"]]]]]'
378
+ ) { throw r }
379
+ }
@@ -7,6 +7,7 @@ const list = require('../list')
7
7
 
8
8
  require('./find/test')
9
9
  require('./set/test')
10
+ require('./remove/test')
10
11
 
11
12
  const jsonStr = json.stringify(sort)
12
13