functionalscript 0.1.609 → 0.2.0

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.
Files changed (175) hide show
  1. package/com/cpp/module.f.d.mts +4 -8
  2. package/com/cpp/module.f.mjs +20 -25
  3. package/com/cpp/testlib.f.mjs +3 -4
  4. package/com/cs/module.f.d.mts +4 -8
  5. package/com/cs/module.f.mjs +18 -23
  6. package/com/cs/testlib.f.mjs +3 -5
  7. package/com/rust/module.f.d.mts +3 -7
  8. package/com/rust/module.f.mjs +25 -30
  9. package/com/rust/testlib.f.mjs +3 -5
  10. package/com/test/build.f.d.mts +2 -2
  11. package/com/test/build.f.mjs +2 -2
  12. package/com/test/build.mjs +4 -4
  13. package/com/types/module.f.d.mts +5 -10
  14. package/com/types/module.f.mjs +5 -12
  15. package/commonjs/build/module.f.d.mts +13 -17
  16. package/commonjs/build/module.f.mjs +23 -28
  17. package/commonjs/build/test.f.mjs +4 -4
  18. package/commonjs/module/function/module.f.d.mts +0 -2
  19. package/commonjs/module/function/module.f.mjs +0 -2
  20. package/commonjs/module/module.f.d.mts +16 -21
  21. package/commonjs/module/module.f.mjs +2 -9
  22. package/commonjs/module.d.mts +1 -5
  23. package/commonjs/module.f.d.mts +0 -2
  24. package/commonjs/module.f.mjs +0 -2
  25. package/commonjs/module.mjs +2 -7
  26. package/commonjs/package/dependencies/module.f.d.mts +3 -7
  27. package/commonjs/package/dependencies/module.f.mjs +5 -10
  28. package/commonjs/package/dependencies/test.f.mjs +1 -1
  29. package/commonjs/package/module.f.d.mts +12 -18
  30. package/commonjs/package/module.f.mjs +6 -13
  31. package/commonjs/package/test.f.mjs +1 -1
  32. package/commonjs/path/module.f.d.mts +25 -32
  33. package/commonjs/path/module.f.mjs +12 -23
  34. package/commonjs/path/test.f.mjs +11 -11
  35. package/commonjs/test.mjs +1 -1
  36. package/dev/module.f.d.mts +1 -4
  37. package/dev/module.f.mjs +1 -4
  38. package/dev/test/module.f.d.mts +2 -3
  39. package/dev/test/module.f.mjs +4 -6
  40. package/djs/module.f.d.mts +13 -18
  41. package/djs/module.f.mjs +12 -19
  42. package/djs/parser/module.f.d.mts +11 -15
  43. package/djs/parser/module.f.mjs +18 -24
  44. package/djs/parser/test.f.mjs +9 -9
  45. package/djs/test.f.mjs +4 -4
  46. package/djs/tokenizer/module.f.d.mts +6 -10
  47. package/djs/tokenizer/module.f.mjs +18 -23
  48. package/djs/tokenizer/test.f.mjs +6 -6
  49. package/fsc/module.f.d.mts +4 -9
  50. package/fsc/module.f.mjs +17 -24
  51. package/fsc/test.f.mjs +3 -3
  52. package/fsm/module.f.d.mts +13 -20
  53. package/fsm/module.f.mjs +27 -38
  54. package/fsm/test.f.mjs +8 -8
  55. package/html/module.f.d.mts +7 -12
  56. package/html/module.f.mjs +14 -23
  57. package/html/test.f.mjs +4 -4
  58. package/js/tokenizer/module.f.d.mts +10 -15
  59. package/js/tokenizer/module.f.mjs +55 -62
  60. package/js/tokenizer/test.f.mjs +6 -6
  61. package/json/module.f.d.mts +18 -26
  62. package/json/module.f.mjs +18 -31
  63. package/json/parser/module.f.d.mts +9 -13
  64. package/json/parser/module.f.mjs +9 -14
  65. package/json/parser/test.f.mjs +7 -7
  66. package/json/serializer/module.f.d.mts +11 -20
  67. package/json/serializer/module.f.mjs +14 -29
  68. package/json/serializer/test.f.mjs +2 -2
  69. package/json/test.f.mjs +3 -3
  70. package/json/tokenizer/module.f.d.mts +6 -10
  71. package/json/tokenizer/module.f.mjs +14 -19
  72. package/json/tokenizer/test.f.mjs +6 -6
  73. package/jsr.json +1 -1
  74. package/nodejs/version/main.mjs +1 -1
  75. package/nodejs/version/module.f.d.mts +4 -9
  76. package/nodejs/version/module.f.mjs +2 -7
  77. package/nodejs/version/test.f.mjs +3 -3
  78. package/package.json +1 -1
  79. package/prime_field/module.f.d.mts +20 -23
  80. package/prime_field/module.f.mjs +9 -12
  81. package/prime_field/test.f.mjs +1 -1
  82. package/secp/module.f.d.mts +27 -28
  83. package/secp/module.f.mjs +38 -39
  84. package/secp/test.f.mjs +4 -4
  85. package/sha2/module.f.d.mts +8 -16
  86. package/sha2/module.f.mjs +7 -20
  87. package/sha2/test.f.mjs +4 -4
  88. package/text/ascii/module.f.d.mts +69 -72
  89. package/text/ascii/module.f.mjs +5 -10
  90. package/text/ascii/test.f.mjs +3 -3
  91. package/text/module.f.d.mts +9 -14
  92. package/text/module.f.mjs +7 -14
  93. package/text/sgr/module.f.d.mts +7 -9
  94. package/text/sgr/module.f.mjs +2 -4
  95. package/text/test.f.mjs +3 -3
  96. package/text/utf16/module.f.d.mts +8 -15
  97. package/text/utf16/module.f.mjs +17 -28
  98. package/text/utf16/test.f.mjs +5 -5
  99. package/text/utf8/module.f.d.mts +4 -9
  100. package/text/utf8/module.f.mjs +9 -16
  101. package/text/utf8/test.f.mjs +4 -4
  102. package/types/array/module.f.d.mts +14 -24
  103. package/types/array/module.f.mjs +8 -25
  104. package/types/array/test.f.mjs +3 -3
  105. package/types/bigfloat/module.f.d.mts +4 -9
  106. package/types/bigfloat/module.f.mjs +3 -10
  107. package/types/bigfloat/test.f.mjs +1 -1
  108. package/types/bigint/module.f.d.mts +16 -64
  109. package/types/bigint/module.f.mjs +11 -30
  110. package/types/bigint/test.f.mjs +1 -1
  111. package/types/btree/find/module.f.d.mts +20 -26
  112. package/types/btree/find/module.f.mjs +8 -17
  113. package/types/btree/find/test.f.mjs +7 -7
  114. package/types/btree/module.f.d.mts +4 -8
  115. package/types/btree/module.f.mjs +6 -11
  116. package/types/btree/remove/module.f.d.mts +7 -12
  117. package/types/btree/remove/module.f.mjs +10 -17
  118. package/types/btree/remove/test.f.mjs +5 -5
  119. package/types/btree/set/module.f.d.mts +3 -7
  120. package/types/btree/set/module.f.mjs +4 -9
  121. package/types/btree/set/test.f.mjs +4 -4
  122. package/types/btree/test.f.mjs +9 -9
  123. package/types/btree/types/module.f.d.mts +0 -2
  124. package/types/btree/types/module.f.mjs +0 -2
  125. package/types/byte_set/module.f.d.mts +16 -29
  126. package/types/byte_set/module.f.mjs +14 -39
  127. package/types/byte_set/test.f.mjs +5 -5
  128. package/types/function/compare/module.f.d.mts +9 -15
  129. package/types/function/compare/module.f.mjs +3 -12
  130. package/types/function/compare/test.f.mjs +1 -1
  131. package/types/function/module.f.d.mts +20 -27
  132. package/types/function/module.f.mjs +4 -15
  133. package/types/function/operator/module.f.d.mts +28 -43
  134. package/types/function/operator/module.f.mjs +14 -41
  135. package/types/function/test.f.mjs +1 -1
  136. package/types/list/module.f.d.mts +56 -91
  137. package/types/list/module.f.mjs +45 -114
  138. package/types/list/test.f.mjs +10 -10
  139. package/types/map/module.f.d.mts +15 -24
  140. package/types/map/module.f.mjs +15 -30
  141. package/types/map/test.f.mjs +2 -2
  142. package/types/nibble_set/module.f.d.mts +10 -20
  143. package/types/nibble_set/module.f.mjs +7 -24
  144. package/types/nibble_set/test.f.mjs +2 -2
  145. package/types/nullable/module.f.d.mts +3 -8
  146. package/types/nullable/module.f.mjs +2 -9
  147. package/types/nullable/test.f.mjs +1 -1
  148. package/types/number/module.f.d.mts +7 -13
  149. package/types/number/module.f.mjs +8 -19
  150. package/types/number/test.f.mjs +1 -1
  151. package/types/object/module.f.d.mts +11 -18
  152. package/types/object/module.f.mjs +9 -20
  153. package/types/object/test.f.mjs +1 -1
  154. package/types/range/module.f.d.mts +3 -8
  155. package/types/range/module.f.mjs +2 -9
  156. package/types/range/test.f.mjs +1 -1
  157. package/types/range_map/module.f.d.mts +9 -15
  158. package/types/range_map/module.f.mjs +9 -18
  159. package/types/range_map/test.f.mjs +32 -32
  160. package/types/result/module.d.mts +3 -3
  161. package/types/result/module.f.d.mts +6 -12
  162. package/types/result/module.f.mjs +3 -12
  163. package/types/result/module.mjs +2 -2
  164. package/types/sorted_list/module.f.d.mts +22 -28
  165. package/types/sorted_list/module.f.mjs +10 -19
  166. package/types/sorted_list/test.f.mjs +7 -7
  167. package/types/sorted_set/module.f.d.mts +6 -12
  168. package/types/sorted_set/module.f.mjs +7 -16
  169. package/types/sorted_set/test.f.mjs +7 -7
  170. package/types/string/module.f.d.mts +8 -14
  171. package/types/string/module.f.mjs +10 -21
  172. package/types/string/test.f.mjs +2 -2
  173. package/types/string_set/module.f.d.mts +8 -16
  174. package/types/string_set/module.f.mjs +12 -27
  175. package/types/string_set/test.f.mjs +1 -1
@@ -1,7 +1,7 @@
1
1
  // @ts-self-types="./module.f.d.mts"
2
- import function_ from '../function/module.f.mjs'
2
+ import * as function_ from '../function/module.f.mjs'
3
3
  const { identity, fn, compose } = function_
4
- import operator, * as Operator from '../function/operator/module.f.mjs'
4
+ import * as operator from '../function/operator/module.f.mjs'
5
5
  const {
6
6
  addition,
7
7
  logicalNot,
@@ -62,7 +62,7 @@ const fromArray = array => {
62
62
  }
63
63
 
64
64
  /** @type {<T>(head: List<T>) => (tail: List<T>) => List<T>} */
65
- const concat = head => tail => tail === null ? head : ({ head, tail })
65
+ export const concat = head => tail => tail === null ? head : ({ head, tail })
66
66
 
67
67
  /** @type {<T>(list: List<T>) => NotLazy<T> } */
68
68
  const trampoline = list => {
@@ -71,7 +71,7 @@ const trampoline = list => {
71
71
  }
72
72
 
73
73
  /** @type {<T>(list: List<T>) => Result<T>} */
74
- const next = head => {
74
+ export const next = head => {
75
75
  /** @type {typeof head} */
76
76
  let tail = null
77
77
  while (true) {
@@ -95,7 +95,7 @@ const next = head => {
95
95
  }
96
96
 
97
97
  /** @type {<T>(list: List<T>) => Iterable<T>} */
98
- const iterable = list => ({
98
+ export const iterable = list => ({
99
99
  *[Symbol.iterator]() {
100
100
  let i = list
101
101
  while (true) {
@@ -110,7 +110,7 @@ const iterable = list => ({
110
110
  const { from } = Array
111
111
 
112
112
  /** @type {<T>(list: List<T>) => readonly T[]} */
113
- const toArray = list => {
113
+ export const toArray = list => {
114
114
  const u = trampoline(list)
115
115
  return u instanceof Array ? u : from(iterable(u))
116
116
  }
@@ -126,16 +126,16 @@ const apply = f => input => () => {
126
126
  const flatStep = ({ first, tail }) => concat(first)(flat(tail))
127
127
 
128
128
  /** @type {<T>(list: List<List<T>>) => Thunk<T>} */
129
- const flat = apply(flatStep)
129
+ export const flat = apply(flatStep)
130
130
 
131
131
  /** @type {<I, O>(f: (value: I) => O) => (n: NonEmpty<I>) => List<O>} */
132
132
  const mapStep = f => ({ first, tail }) => ({ first: f(first), tail: map(f)(tail) })
133
133
 
134
134
  /** @type {<I, O>(f: (value: I) => O) => (input: List<I>) => Thunk<O>} */
135
- const map = f => apply(mapStep(f))
135
+ export const map = f => apply(mapStep(f))
136
136
 
137
137
  /** @type {<I, O>(f: (value: I) => List<O>) => (input: List<I>) => Thunk<O>} */
138
- const flatMap = f => compose(map(f))(flat)
138
+ export const flatMap = f => compose(map(f))(flat)
139
139
 
140
140
  /** @type {<T>(f: (value: T) => boolean) => (n: NonEmpty<T>) => List<T>} */
141
141
  const filterStep = f => ({ first, tail }) => {
@@ -144,7 +144,7 @@ const filterStep = f => ({ first, tail }) => {
144
144
  }
145
145
 
146
146
  /** @type {<T>(f: (value: T) => boolean) => (input: List<T>) => Thunk<T>} */
147
- const filter = f => apply(filterStep(f))
147
+ export const filter = f => apply(filterStep(f))
148
148
 
149
149
  /** @type {<I, O>(f: (value: I) => O|null) => (n: NonEmpty<I>) => List<O>} */
150
150
  const filterMapStep = f => n => {
@@ -153,40 +153,40 @@ const filterMapStep = f => n => {
153
153
  }
154
154
 
155
155
  /** @type {<I, O>(f: (value: I) => O|null) => (input: List<I>) => Thunk<O>} */
156
- const filterMap = f => apply(filterMapStep(f))
156
+ export const filterMap = f => apply(filterMapStep(f))
157
157
 
158
158
  /** @type {<T>(f: (value: T) => boolean) => (n: NonEmpty<T>) => List<T>} */
159
159
  const takeWhileStep = f => ({ first, tail }) => f(first) ? { first, tail: takeWhile(f)(tail) } : null
160
160
 
161
161
  /** @type {<T>(f: (value: T) => boolean) => (input: List<T>) => Thunk<T>} */
162
- const takeWhile = f => apply(takeWhileStep(f))
162
+ export const takeWhile = f => apply(takeWhileStep(f))
163
163
 
164
164
  /** @type {(n: number) => <T>(result: NonEmpty<T>) => List<T>} */
165
165
  const takeStep = n => ({ first, tail }) => 0 < n ? { first: first, tail: take(n - 1)(tail) } : null
166
166
 
167
167
  /** @type {(n: number) => <T>(input: List<T>) => Thunk<T>} */
168
- const take = n => apply(takeStep(n))
168
+ export const take = n => apply(takeStep(n))
169
169
 
170
170
  /** @type {<T>(f: (value: T) => boolean) => (ne: NonEmpty<T>) => List<T>} */
171
171
  const dropWhileStep = f => ne => f(ne.first) ? dropWhile(f)(ne.tail) : ne
172
172
 
173
173
  /** @type {<T>(f: (value: T) => boolean) => (input: List<T>) => Thunk<T>} */
174
- const dropWhile = f => apply(dropWhileStep(f))
174
+ export const dropWhile = f => apply(dropWhileStep(f))
175
175
 
176
176
  /** @type {(n: number) => <T>(ne: NonEmpty<T>) => List<T>} */
177
177
  const dropStep = n => ne => 0 < n ? drop(n - 1)(ne.tail) : ne
178
178
 
179
179
  /** @type {(n: number) => <T>(input: List<T>) => Thunk<T>} */
180
- const drop = n => apply(dropStep(n))
180
+ export const drop = n => apply(dropStep(n))
181
181
 
182
182
  /** @type {<D>(def: D) => <T>(input: List<T>) => D|T} */
183
- const first = def => input => {
183
+ export const first = def => input => {
184
184
  const ne = next(input)
185
185
  return ne === null ? def : ne.first
186
186
  }
187
187
 
188
188
  /** @type {<D>(first: D) => <T>(tail: List<T>) => D|T} */
189
- const last = first => tail => {
189
+ export const last = first => tail => {
190
190
  /** @typedef {typeof tail extends List<infer T> ? T : never} T */
191
191
  /** @type {NonEmpty<typeof first|T>} */
192
192
  let i = { first, tail }
@@ -200,61 +200,61 @@ const last = first => tail => {
200
200
  }
201
201
 
202
202
  /** @type {<D>(def: D) => <T>(f: (value: T) => boolean) => (input: List<T>) => D|T} */
203
- const find = def => f => compose(filter(f))(first(def))
203
+ export const find = def => f => compose(filter(f))(first(def))
204
204
 
205
205
  /** @type {(input: List<boolean>) => boolean} */
206
- const some = find(false)(identity)
206
+ export const some = find(false)(identity)
207
207
 
208
208
  /** @type {<T>(input: List<T>) => boolean} */
209
- const isEmpty = fn(map(() => true))
209
+ export const isEmpty = fn(map(() => true))
210
210
  .then(some)
211
211
  .then(logicalNot)
212
212
  .result
213
213
 
214
- const every = fn(map(logicalNot))
214
+ export const every = fn(map(logicalNot))
215
215
  .then(some)
216
216
  .then(logicalNot)
217
217
  .result
218
218
 
219
219
  /** @type {<T>(value: T) => (sequence: List<T>) => boolean} */
220
- const includes = value => compose(map(strictEqual(value)))(some)
220
+ export const includes = value => compose(map(strictEqual(value)))(some)
221
221
 
222
222
  /** @type {(count: number) => Thunk<number>} */
223
- const countdown = count => () => {
223
+ export const countdown = count => () => {
224
224
  if (count <= 0) { return null }
225
225
  const first = count - 1
226
226
  return { first, tail: countdown(first) }
227
227
  }
228
228
 
229
229
  /** @type {<T>(v: T) => (c: number) => Thunk<T>} */
230
- const repeat = v => compose(countdown)(map(() => v))
230
+ export const repeat = v => compose(countdown)(map(() => v))
231
231
 
232
232
  /** @type {<T>(list: List<T>) => List<T>} */
233
- const cycle = list => () => {
233
+ export const cycle = list => () => {
234
234
  const i = next(list)
235
235
  return i === null ? null : { first: i.first, tail: concat(i.tail)(cycle(list)) }
236
236
  }
237
237
 
238
- /** @type {<I, O>(op: Operator.Scan<I, O>) => (ne: NonEmpty<I>) => List<O>} */
238
+ /** @type {<I, O>(op: operator.Scan<I, O>) => (ne: NonEmpty<I>) => List<O>} */
239
239
  const scanStep = op => ne => {
240
240
  const [first, newOp] = op(ne.first)
241
241
  return { first, tail: scan(newOp)(ne.tail) }
242
242
  }
243
243
 
244
- /** @type {<I, O>(op: Operator.Scan<I, O>) => (input: List<I>) => Thunk<O>} */
245
- const scan = op => apply(scanStep(op))
244
+ /** @type {<I, O>(op: operator.Scan<I, O>) => (input: List<I>) => Thunk<O>} */
245
+ export const scan = op => apply(scanStep(op))
246
246
 
247
- /** @type {<I, S, O>(op: Operator.StateScan<I, S, O>) => (init: S) => (input: List<I>) => Thunk<O>} */
248
- const stateScan = op => compose(stateScanToScan(op))(scan)
247
+ /** @type {<I, S, O>(op: operator.StateScan<I, S, O>) => (init: S) => (input: List<I>) => Thunk<O>} */
248
+ export const stateScan = op => compose(stateScanToScan(op))(scan)
249
249
 
250
- /** @type {<I,O>(op: Operator.Fold<I, O>) => (init: O) => (input: List<I>) => Thunk<O>} */
251
- const foldScan = op => compose(foldToScan(op))(scan)
250
+ /** @type {<I,O>(op: operator.Fold<I, O>) => (init: O) => (input: List<I>) => Thunk<O>} */
251
+ export const foldScan = op => compose(foldToScan(op))(scan)
252
252
 
253
- /** @type {<I,O>(op: Operator.Fold<I, O>) => (init: O) => (input: List<I>) => O} */
254
- const fold = op => init => compose(foldScan(op)(init))(last(init))
253
+ /** @type {<I,O>(op: operator.Fold<I, O>) => (init: O) => (input: List<I>) => O} */
254
+ export const fold = op => init => compose(foldScan(op)(init))(last(init))
255
255
 
256
- /** @type {<T>(op: Operator.Reduce<T>) => <D>(def: D) => (input: List<T>) => D|T} */
257
- const reduce = op => def => compose(scan(reduceToScan(op)))(last(def))
256
+ /** @type {<T>(op: operator.Reduce<T>) => <D>(def: D) => (input: List<T>) => D|T} */
257
+ export const reduce = op => def => compose(scan(reduceToScan(op)))(last(def))
258
258
 
259
259
  /** @type {<T>(list: List<T>) => Thunk<number>} */
260
260
  const lengthList = list => () => {
@@ -271,7 +271,7 @@ const lengthList = list => () => {
271
271
  const sum = reduce(addition)(0)
272
272
 
273
273
  /** @type {<T>(input: List<T>) => number} */
274
- const length = compose(lengthList)(sum)
274
+ export const length = compose(lengthList)(sum)
275
275
 
276
276
  /**
277
277
  * @template T
@@ -282,9 +282,9 @@ const length = compose(lengthList)(sum)
282
282
  const entryOperator = index => value => [[index, value], index + 1]
283
283
 
284
284
  /** @type {<T>(input: List<T>) => Thunk<Entry<T>>} */
285
- const entries = input => {
285
+ export const entries = input => {
286
286
  /** @typedef {typeof input extends List<infer T> ? T : never} T */
287
- /** @type {Operator.StateScan<T, Number, Entry<T>>} */
287
+ /** @type {operator.StateScan<T, Number, Entry<T>>} */
288
288
  const o = entryOperator
289
289
  return stateScan(o)(0)(input)
290
290
  }
@@ -293,10 +293,10 @@ const entries = input => {
293
293
  const reverseOperator = first => tail => ({ first, tail })
294
294
 
295
295
  /** @type {<T>(input: List<T>) => List<T>} */
296
- const reverse = fold(reverseOperator)(null)
296
+ export const reverse = fold(reverseOperator)(null)
297
297
 
298
298
  /** @type {<A>(a: List<A>) => <B>(b: List<B>) => Thunk<readonly[A, B]>} */
299
- const zip = a => b => () => {
299
+ export const zip = a => b => () => {
300
300
  const aResult = next(a)
301
301
  if (aResult === null) { return null }
302
302
  const bResult = next(b)
@@ -304,9 +304,9 @@ const zip = a => b => () => {
304
304
  return { first: [aResult.first, bResult.first], tail: zip(aResult.tail)(bResult.tail) }
305
305
  }
306
306
 
307
- /** @type {<T>(e: Operator.Equal<T>) => (a: List<T>) => (b: List<T>) => boolean} */
308
- const equal = e => {
309
- /** @typedef {typeof e extends Operator.Equal<infer T> ? T : never} T */
307
+ /** @type {<T>(e: operator.Equal<T>) => (a: List<T>) => (b: List<T>) => boolean} */
308
+ export const equal = e => {
309
+ /** @typedef {typeof e extends operator.Equal<infer T> ? T : never} T */
310
310
  /** @type {(a: List<T>) => (b: List<T>) => List<boolean>} */
311
311
  const f = a => b => () => {
312
312
  const [aResult, bResult] = [next(a), next(b)]
@@ -317,73 +317,4 @@ const equal = e => {
317
317
  return a => b => every(f(a)(b))
318
318
  }
319
319
 
320
- export default {
321
- /** @readonly */
322
- empty: null,
323
- /** @readonly */
324
- concat,
325
- /** @readonly */
326
- next,
327
- /** @readonly */
328
- iterable,
329
- /** @readonly */
330
- toArray,
331
- /** @readonly */
332
- flat,
333
- /** @readonly */
334
- map,
335
- /** @readonly */
336
- flatMap,
337
- /** @readonly */
338
- filter,
339
- /** @readonly */
340
- filterMap,
341
- /** @readonly */
342
- takeWhile,
343
- /** @readonly */
344
- take,
345
- /** @readonly */
346
- dropWhile,
347
- /** @readonly */
348
- drop,
349
- /** @readonly */
350
- first,
351
- /** @readonly */
352
- last,
353
- /** @readonly */
354
- find,
355
- /** @readonly */
356
- some,
357
- /** @readonly */
358
- every,
359
- /** @readonly */
360
- isEmpty,
361
- /** @readonly */
362
- includes,
363
- /** @readonly */
364
- countdown,
365
- /** @readonly */
366
- repeat,
367
- /** @readonly */
368
- cycle,
369
- /** @readonly */
370
- scan,
371
- /** @readonly */
372
- stateScan,
373
- /** @readonly */
374
- foldScan,
375
- /** @readonly */
376
- fold,
377
- /** @readonly */
378
- reduce,
379
- /** @readonly */
380
- length,
381
- /** @readonly */
382
- entries,
383
- /** @readonly */
384
- reverse,
385
- /** @readonly */
386
- zip,
387
- /** @readonly */
388
- equal
389
- }
320
+ export const empty = null
@@ -1,11 +1,11 @@
1
- import _, * as T from './module.f.mjs'
2
- import json, * as Json from '../../json/module.f.mjs'
3
- import o from '../object/module.f.mjs'
1
+ import * as _ from './module.f.mjs'
2
+ import * as json from '../../json/module.f.mjs'
3
+ import * as o from '../object/module.f.mjs'
4
4
  const { sort } = o
5
- import operator from '../function/operator/module.f.mjs'
5
+ import * as operator from '../function/operator/module.f.mjs'
6
6
  const { addition, strictEqual, reduceToScan } = operator
7
7
 
8
- /** @type {(sequence: T.List<Json.Unknown>) => string} */
8
+ /** @type {(sequence: _.List<json.Unknown>) => string} */
9
9
  const stringify = sequence => json.stringify(sort)(_.toArray(sequence))
10
10
 
11
11
  const stringifyTest = () => {
@@ -197,7 +197,7 @@ const stress = () => ({
197
197
  if (first !== n - 1) { throw first }
198
198
  },
199
199
  concatBack: () => {
200
- /** @type {T.List<number>} */
200
+ /** @type {_.List<number>} */
201
201
  let sequence = []
202
202
  // 20_000_000 is too much
203
203
  // 10_000_000 is too much for Deno 1
@@ -207,7 +207,7 @@ const stress = () => ({
207
207
  const r = _.toArray(sequence)
208
208
  },
209
209
  flatToArray: () => {
210
- /** @type {T.List<number>} */
210
+ /** @type {_.List<number>} */
211
211
  let sequence = []
212
212
  // 4_000_000 is too much
213
213
  for (let i = 0; i < 2_000_000; ++i) {
@@ -216,7 +216,7 @@ const stress = () => ({
216
216
  const r = _.toArray(sequence)
217
217
  },
218
218
  flatNext: () => {
219
- /** @type {T.List<number>} */
219
+ /** @type {_.List<number>} */
220
220
  let sequence = []
221
221
  // 4_000_000 is too much
222
222
  for (let i = 0; i < 2_000_000; ++i) {
@@ -225,7 +225,7 @@ const stress = () => ({
225
225
  const a = _.next(sequence)
226
226
  },
227
227
  concatFront: () => {
228
- /** @type {T.List<number>} */
228
+ /** @type {_.List<number>} */
229
229
  let sequence = []
230
230
  // 20_000_000 is too much
231
231
  for (let i = 0; i < 10_000_000; ++i) {
@@ -234,7 +234,7 @@ const stress = () => ({
234
234
  const a = _.next(sequence)
235
235
  },
236
236
  flatFront: () => {
237
- /** @type {T.List<number>} */
237
+ /** @type {_.List<number>} */
238
238
  let sequence = []
239
239
  // 10_000_000 is too much
240
240
  for (let i = 0; i < 5_000_000; ++i) {
@@ -1,30 +1,21 @@
1
- declare namespace _default {
2
- export let empty: null;
3
- export { at };
4
- export { setReduce };
5
- export { setReplace };
6
- export { entries };
7
- export { fromEntries };
8
- export { remove };
9
- }
10
- export default _default;
11
- export type Sign = Compare.Sign;
12
- export type Cmp<T> = Compare.Compare<T>;
13
- export type Entry<T> = readonly [string, T];
14
- export type Map<T> = BtreeTypes.Tree<Entry<T>>;
15
1
  /** @type {(name: string) => <T>(map: Map<T>) => T|null} */
16
- declare const at: (name: string) => <T>(map: Map<T>) => T | null;
2
+ export const at: (name: string) => <T>(map: Map<T>) => T | null;
17
3
  /** @type {<T>(reduce: Operator.Reduce<T>) => (name: string) => (value: T) => (map: Map<T>) => Map<T>} */
18
- declare const setReduce: <T>(reduce: Operator.Reduce<T>) => (name: string) => (value: T) => (map: Map<T>) => Map<T>;
4
+ export const setReduce: <T>(reduce: Operator.Reduce<T>) => (name: string) => (value: T) => (map: Map<T>) => Map<T>;
19
5
  /** @type {(name: string) => <T>(value: T) => (map: Map<T>) => Map<T>} */
20
- declare const setReplace: (name: string) => <T>(value: T) => (map: Map<T>) => Map<T>;
21
- /** @type {<T>(map: Map<T>) => List.List<Entry<T>>} */
22
- declare const entries: <T>(map: Map<T>) => List.List<Entry<T>>;
23
- /** @type {<T>(entries: List.List<Entry<T>>) => Map<T>} */
24
- declare const fromEntries: <T>(entries: List.List<Entry<T>>) => Map<T>;
6
+ export const setReplace: (name: string) => <T>(value: T) => (map: Map<T>) => Map<T>;
7
+ /** @type {<T>(map: Map<T>) => list.List<Entry<T>>} */
8
+ export const entries: <T>(map: Map<T>) => list.List<Entry<T>>;
9
+ /** @type {<T>(entries: list.List<Entry<T>>) => Map<T>} */
10
+ export const fromEntries: <T>(entries: list.List<Entry<T>>) => Map<T>;
25
11
  /** @type {(name: string) => <T>(map: Map<T>) => Map<T>} */
26
- declare const remove: (name: string) => <T>(map: Map<T>) => Map<T>;
12
+ export const remove: (name: string) => <T>(map: Map<T>) => Map<T>;
13
+ export const empty: null;
14
+ export type Sign = Compare.Sign;
15
+ export type Cmp<T> = Compare.Compare<T>;
16
+ export type Entry<T> = readonly [string, T];
17
+ export type Map<T> = BtreeTypes.Tree<Entry<T>>;
18
+ import * as Operator from '../function/operator/module.f.mjs';
19
+ import * as list from '../list/module.f.mjs';
27
20
  import * as Compare from '../function/compare/module.f.mjs';
28
21
  import * as BtreeTypes from '../btree/types/module.f.mjs';
29
- import * as Operator from '../function/operator/module.f.mjs';
30
- import * as List from '../list/module.f.mjs';
@@ -1,17 +1,17 @@
1
1
  // @ts-self-types="./module.f.d.mts"
2
2
  import * as BtreeTypes from '../btree/types/module.f.mjs'
3
- import btf from '../btree/find/module.f.mjs'
3
+ import * as btf from '../btree/find/module.f.mjs'
4
4
  const { value, find } = btf
5
- import bts from '../btree/set/module.f.mjs'
5
+ import * as bts from '../btree/set/module.f.mjs'
6
6
  const { set } = bts
7
- import btr from '../btree/remove/module.f.mjs'
7
+ import * as btr from '../btree/remove/module.f.mjs'
8
8
  const { remove: btreeRemove } = btr
9
- import bt from '../btree/module.f.mjs'
9
+ import * as bt from '../btree/module.f.mjs'
10
10
  const { values } = bt
11
11
  import * as Compare from '../function/compare/module.f.mjs'
12
- import s from '../string/module.f.mjs'
12
+ import * as s from '../string/module.f.mjs'
13
13
  const { cmp } = s
14
- import list, * as List from '../list/module.f.mjs'
14
+ import * as list from '../list/module.f.mjs'
15
15
  const { fold } = list
16
16
  import * as Operator from '../function/operator/module.f.mjs'
17
17
 
@@ -36,7 +36,7 @@ import * as Operator from '../function/operator/module.f.mjs'
36
36
  const keyCmp = a => ([b]) => cmp(a)(b)
37
37
 
38
38
  /** @type {(name: string) => <T>(map: Map<T>) => T|null} */
39
- const at = name => map => {
39
+ export const at = name => map => {
40
40
  if (map === null) { return null }
41
41
  const result = value(find(keyCmp(name))(map).first)
42
42
  return result === null ? null : result[1]
@@ -47,36 +47,21 @@ const setReduceEntry = reduce => entry =>
47
47
  set(keyCmp(entry[0]))(old => old === null ? entry : [old[0], reduce(old[1])(entry[1])])
48
48
 
49
49
  /** @type {<T>(reduce: Operator.Reduce<T>) => (name: string) => (value: T) => (map: Map<T>) => Map<T>} */
50
- const setReduce = reduce => name => value => setReduceEntry(reduce)([name, value])
50
+ export const setReduce = reduce => name => value => setReduceEntry(reduce)([name, value])
51
51
 
52
52
  /** @type {<T>(a: T) => (b: T) => T} */
53
53
  const replace = () => b => b
54
54
 
55
55
  /** @type {(name: string) => <T>(value: T) => (map: Map<T>) => Map<T>} */
56
- const setReplace = name => value => setReduceEntry(replace)([name, value])
56
+ export const setReplace = name => value => setReduceEntry(replace)([name, value])
57
57
 
58
- /** @type {<T>(map: Map<T>) => List.List<Entry<T>>} */
59
- const entries = values
58
+ /** @type {<T>(map: Map<T>) => list.List<Entry<T>>} */
59
+ export const entries = values
60
60
 
61
- /** @type {<T>(entries: List.List<Entry<T>>) => Map<T>} */
62
- const fromEntries = fold(setReduceEntry(replace))(null)
61
+ /** @type {<T>(entries: list.List<Entry<T>>) => Map<T>} */
62
+ export const fromEntries = fold(setReduceEntry(replace))(null)
63
63
 
64
64
  /** @type {(name: string) => <T>(map: Map<T>) => Map<T>} */
65
- const remove = name => btreeRemove(keyCmp(name))
65
+ export const remove = name => btreeRemove(keyCmp(name))
66
66
 
67
- export default {
68
- /** @readonly */
69
- empty: null,
70
- /** @readonly */
71
- at,
72
- /** @readonly */
73
- setReduce,
74
- /** @readonly */
75
- setReplace,
76
- /** @readonly */
77
- entries,
78
- /** @readonly */
79
- fromEntries,
80
- /** @readonly */
81
- remove,
82
- }
67
+ export const empty = null
@@ -1,6 +1,6 @@
1
- import _ from './module.f.mjs'
1
+ import * as _ from './module.f.mjs'
2
2
  const { at, setReplace, setReduce, empty, entries, remove } = _
3
- import seq from '../list/module.f.mjs'
3
+ import * as seq from '../list/module.f.mjs'
4
4
 
5
5
  export default {
6
6
  main: [
@@ -1,26 +1,16 @@
1
- declare namespace _default {
2
- export { empty };
3
- export { universe };
4
- export { has };
5
- export { complement };
6
- export { set };
7
- export { unset };
8
- export { setRange };
9
- }
10
- export default _default;
11
- export type NibbleSet = number;
12
- export type Nibble = number;
13
1
  /** @typedef {number} NibbleSet */
14
2
  /** @typedef {number} Nibble */
15
- declare const empty: 0;
16
- declare const universe: 65535;
3
+ export const empty: 0;
4
+ export const universe: 65535;
17
5
  /** @type {(n: Nibble) => (s: NibbleSet) => boolean} */
18
- declare const has: (n: Nibble) => (s: NibbleSet) => boolean;
19
- /** @type {(n: NibbleSet) => NibbleSet} */
20
- declare const complement: (n: NibbleSet) => NibbleSet;
6
+ export const has: (n: Nibble) => (s: NibbleSet) => boolean;
21
7
  /** @type {(n: Nibble) => (s: NibbleSet) => NibbleSet} */
22
- declare const set: (n: Nibble) => (s: NibbleSet) => NibbleSet;
8
+ export const set: (n: Nibble) => (s: NibbleSet) => NibbleSet;
9
+ /** @type {(n: NibbleSet) => NibbleSet} */
10
+ export const complement: (n: NibbleSet) => NibbleSet;
23
11
  /** @type {(n: Nibble) => (s: NibbleSet) => NibbleSet} */
24
- declare const unset: (n: Nibble) => (s: NibbleSet) => NibbleSet;
12
+ export const unset: (n: Nibble) => (s: NibbleSet) => NibbleSet;
25
13
  /** @type {(r: readonly[number, number]) => (s: NibbleSet) => NibbleSet} */
26
- declare const setRange: (r: readonly [number, number]) => (s: NibbleSet) => NibbleSet;
14
+ export const setRange: (r: readonly [number, number]) => (s: NibbleSet) => NibbleSet;
15
+ export type NibbleSet = number;
16
+ export type Nibble = number;
@@ -2,44 +2,27 @@
2
2
  /** @typedef {number} NibbleSet */
3
3
  /** @typedef {number} Nibble */
4
4
 
5
- const empty = 0
5
+ export const empty = 0
6
6
 
7
- const universe = 0xFFFF
7
+ export const universe = 0xFFFF
8
8
 
9
9
  /** @type {(n: Nibble) => NibbleSet} */
10
10
  const one = n => 1 << n
11
11
 
12
12
  /** @type {(n: Nibble) => (s: NibbleSet) => boolean} */
13
- const has = n => s => ((s >> n) & 1) === 1
13
+ export const has = n => s => ((s >> n) & 1) === 1
14
14
 
15
15
  /** @type {(n: Nibble) => (s: NibbleSet) => NibbleSet} */
16
- const set = n => s => s | one(n)
16
+ export const set = n => s => s | one(n)
17
17
 
18
18
  /** @type {(n: NibbleSet) => NibbleSet} */
19
- const complement = s => universe ^ s
19
+ export const complement = s => universe ^ s
20
20
 
21
21
  /** @type {(n: Nibble) => (s: NibbleSet) => NibbleSet} */
22
- const unset = n => s => s & complement(one(n))
22
+ export const unset = n => s => s & complement(one(n))
23
23
 
24
24
  /** @type {(r: readonly[number, number]) => NibbleSet} */
25
25
  const range = ([a, b]) => one(b - a + 1) - 1 << a
26
26
 
27
27
  /** @type {(r: readonly[number, number]) => (s: NibbleSet) => NibbleSet} */
28
- const setRange = r => s => s | range(r)
29
-
30
- export default {
31
- /** @readonly */
32
- empty,
33
- /** @readonly */
34
- universe,
35
- /** @readonly */
36
- has,
37
- /** @readonly */
38
- complement,
39
- /** @readonly */
40
- set,
41
- /** @readonly */
42
- unset,
43
- /** @readonly */
44
- setRange,
45
- }
28
+ export const setRange = r => s => s | range(r)
@@ -1,6 +1,6 @@
1
- import list from '../list/module.f.mjs'
1
+ import * as list from '../list/module.f.mjs'
2
2
  const { every, map, countdown } = list
3
- import _ from './module.f.mjs'
3
+ import * as _ from './module.f.mjs'
4
4
 
5
5
  export default {
6
6
  has: () => {
@@ -1,14 +1,9 @@
1
- declare namespace _default {
2
- export { map };
3
- export { match };
4
- }
5
- export default _default;
6
- export type Nullable<T> = T | null;
7
1
  /**
8
2
  * @template T
9
3
  * @typedef {T|null} Nullable
10
4
  */
11
5
  /** @type {<T, R>(f: (value: T) => R) => (value: Nullable<T>) => Nullable<R>} */
12
- declare const map: <T, R>(f: (value: T) => R) => (value: Nullable<T>) => Nullable<R>;
6
+ export const map: <T, R>(f: (value: T) => R) => (value: Nullable<T>) => Nullable<R>;
13
7
  /** @type {<T, R>(f: (_: T) => R) => (none: () => R) => (_: Nullable<T>) => Nullable<R>} */
14
- declare const match: <T, R>(f: (_: T) => R) => (none: () => R) => (_: Nullable<T>) => Nullable<R>;
8
+ export const match: <T, R>(f: (_: T) => R) => (none: () => R) => (_: Nullable<T>) => Nullable<R>;
9
+ export type Nullable<T> = T | null;
@@ -5,14 +5,7 @@
5
5
  */
6
6
 
7
7
  /** @type {<T, R>(f: (value: T) => R) => (value: Nullable<T>) => Nullable<R>} */
8
- const map = f => value => value === null ? null : f(value)
8
+ export const map = f => value => value === null ? null : f(value)
9
9
 
10
10
  /** @type {<T, R>(f: (_: T) => R) => (none: () => R) => (_: Nullable<T>) => Nullable<R>} */
11
- const match = f => none => value => value === null ? none() : f(value)
12
-
13
- export default {
14
- /** @readonly */
15
- map,
16
- /** @readonly */
17
- match,
18
- }
11
+ export const match = f => none => value => value === null ? none() : f(value)
@@ -1,4 +1,4 @@
1
- import _ from './module.f.mjs'
1
+ import * as _ from './module.f.mjs'
2
2
 
3
3
  export default () => {
4
4
  const optionSq = _.map(v => v * v)