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.
- package/com/cpp/module.f.d.mts +4 -8
- package/com/cpp/module.f.mjs +20 -25
- package/com/cpp/testlib.f.mjs +3 -4
- package/com/cs/module.f.d.mts +4 -8
- package/com/cs/module.f.mjs +18 -23
- package/com/cs/testlib.f.mjs +3 -5
- package/com/rust/module.f.d.mts +3 -7
- package/com/rust/module.f.mjs +25 -30
- package/com/rust/testlib.f.mjs +3 -5
- package/com/test/build.f.d.mts +2 -2
- package/com/test/build.f.mjs +2 -2
- package/com/test/build.mjs +4 -4
- package/com/types/module.f.d.mts +5 -10
- package/com/types/module.f.mjs +5 -12
- package/commonjs/build/module.f.d.mts +13 -17
- package/commonjs/build/module.f.mjs +23 -28
- package/commonjs/build/test.f.mjs +4 -4
- package/commonjs/module/function/module.f.d.mts +0 -2
- package/commonjs/module/function/module.f.mjs +0 -2
- package/commonjs/module/module.f.d.mts +16 -21
- package/commonjs/module/module.f.mjs +2 -9
- package/commonjs/module.d.mts +1 -5
- package/commonjs/module.f.d.mts +0 -2
- package/commonjs/module.f.mjs +0 -2
- package/commonjs/module.mjs +2 -7
- package/commonjs/package/dependencies/module.f.d.mts +3 -7
- package/commonjs/package/dependencies/module.f.mjs +5 -10
- package/commonjs/package/dependencies/test.f.mjs +1 -1
- package/commonjs/package/module.f.d.mts +12 -18
- package/commonjs/package/module.f.mjs +6 -13
- package/commonjs/package/test.f.mjs +1 -1
- package/commonjs/path/module.f.d.mts +25 -32
- package/commonjs/path/module.f.mjs +12 -23
- package/commonjs/path/test.f.mjs +11 -11
- package/commonjs/test.mjs +1 -1
- package/dev/module.f.d.mts +1 -4
- package/dev/module.f.mjs +1 -4
- package/dev/test/module.f.d.mts +2 -3
- package/dev/test/module.f.mjs +4 -6
- package/djs/module.f.d.mts +13 -18
- package/djs/module.f.mjs +12 -19
- package/djs/parser/module.f.d.mts +11 -15
- package/djs/parser/module.f.mjs +18 -24
- package/djs/parser/test.f.mjs +9 -9
- package/djs/test.f.mjs +4 -4
- package/djs/tokenizer/module.f.d.mts +6 -10
- package/djs/tokenizer/module.f.mjs +18 -23
- package/djs/tokenizer/test.f.mjs +6 -6
- package/fsc/module.f.d.mts +4 -9
- package/fsc/module.f.mjs +17 -24
- package/fsc/test.f.mjs +3 -3
- package/fsm/module.f.d.mts +13 -20
- package/fsm/module.f.mjs +27 -38
- package/fsm/test.f.mjs +8 -8
- package/html/module.f.d.mts +7 -12
- package/html/module.f.mjs +14 -23
- package/html/test.f.mjs +4 -4
- package/js/tokenizer/module.f.d.mts +10 -15
- package/js/tokenizer/module.f.mjs +55 -62
- package/js/tokenizer/test.f.mjs +6 -6
- package/json/module.f.d.mts +18 -26
- package/json/module.f.mjs +18 -31
- package/json/parser/module.f.d.mts +9 -13
- package/json/parser/module.f.mjs +9 -14
- package/json/parser/test.f.mjs +7 -7
- package/json/serializer/module.f.d.mts +11 -20
- package/json/serializer/module.f.mjs +14 -29
- package/json/serializer/test.f.mjs +2 -2
- package/json/test.f.mjs +3 -3
- package/json/tokenizer/module.f.d.mts +6 -10
- package/json/tokenizer/module.f.mjs +14 -19
- package/json/tokenizer/test.f.mjs +6 -6
- package/jsr.json +1 -1
- package/nodejs/version/main.mjs +1 -1
- package/nodejs/version/module.f.d.mts +4 -9
- package/nodejs/version/module.f.mjs +2 -7
- package/nodejs/version/test.f.mjs +3 -3
- package/package.json +1 -1
- package/prime_field/module.f.d.mts +20 -23
- package/prime_field/module.f.mjs +9 -12
- package/prime_field/test.f.mjs +1 -1
- package/secp/module.f.d.mts +27 -28
- package/secp/module.f.mjs +38 -39
- package/secp/test.f.mjs +4 -4
- package/sha2/module.f.d.mts +8 -16
- package/sha2/module.f.mjs +7 -20
- package/sha2/test.f.mjs +4 -4
- package/text/ascii/module.f.d.mts +69 -72
- package/text/ascii/module.f.mjs +5 -10
- package/text/ascii/test.f.mjs +3 -3
- package/text/module.f.d.mts +9 -14
- package/text/module.f.mjs +7 -14
- package/text/sgr/module.f.d.mts +7 -9
- package/text/sgr/module.f.mjs +2 -4
- package/text/test.f.mjs +3 -3
- package/text/utf16/module.f.d.mts +8 -15
- package/text/utf16/module.f.mjs +17 -28
- package/text/utf16/test.f.mjs +5 -5
- package/text/utf8/module.f.d.mts +4 -9
- package/text/utf8/module.f.mjs +9 -16
- package/text/utf8/test.f.mjs +4 -4
- package/types/array/module.f.d.mts +14 -24
- package/types/array/module.f.mjs +8 -25
- package/types/array/test.f.mjs +3 -3
- package/types/bigfloat/module.f.d.mts +4 -9
- package/types/bigfloat/module.f.mjs +3 -10
- package/types/bigfloat/test.f.mjs +1 -1
- package/types/bigint/module.f.d.mts +16 -64
- package/types/bigint/module.f.mjs +11 -30
- package/types/bigint/test.f.mjs +1 -1
- package/types/btree/find/module.f.d.mts +20 -26
- package/types/btree/find/module.f.mjs +8 -17
- package/types/btree/find/test.f.mjs +7 -7
- package/types/btree/module.f.d.mts +4 -8
- package/types/btree/module.f.mjs +6 -11
- package/types/btree/remove/module.f.d.mts +7 -12
- package/types/btree/remove/module.f.mjs +10 -17
- package/types/btree/remove/test.f.mjs +5 -5
- package/types/btree/set/module.f.d.mts +3 -7
- package/types/btree/set/module.f.mjs +4 -9
- package/types/btree/set/test.f.mjs +4 -4
- package/types/btree/test.f.mjs +9 -9
- package/types/btree/types/module.f.d.mts +0 -2
- package/types/btree/types/module.f.mjs +0 -2
- package/types/byte_set/module.f.d.mts +16 -29
- package/types/byte_set/module.f.mjs +14 -39
- package/types/byte_set/test.f.mjs +5 -5
- package/types/function/compare/module.f.d.mts +9 -15
- package/types/function/compare/module.f.mjs +3 -12
- package/types/function/compare/test.f.mjs +1 -1
- package/types/function/module.f.d.mts +20 -27
- package/types/function/module.f.mjs +4 -15
- package/types/function/operator/module.f.d.mts +28 -43
- package/types/function/operator/module.f.mjs +14 -41
- package/types/function/test.f.mjs +1 -1
- package/types/list/module.f.d.mts +56 -91
- package/types/list/module.f.mjs +45 -114
- package/types/list/test.f.mjs +10 -10
- package/types/map/module.f.d.mts +15 -24
- package/types/map/module.f.mjs +15 -30
- package/types/map/test.f.mjs +2 -2
- package/types/nibble_set/module.f.d.mts +10 -20
- package/types/nibble_set/module.f.mjs +7 -24
- package/types/nibble_set/test.f.mjs +2 -2
- package/types/nullable/module.f.d.mts +3 -8
- package/types/nullable/module.f.mjs +2 -9
- package/types/nullable/test.f.mjs +1 -1
- package/types/number/module.f.d.mts +7 -13
- package/types/number/module.f.mjs +8 -19
- package/types/number/test.f.mjs +1 -1
- package/types/object/module.f.d.mts +11 -18
- package/types/object/module.f.mjs +9 -20
- package/types/object/test.f.mjs +1 -1
- package/types/range/module.f.d.mts +3 -8
- package/types/range/module.f.mjs +2 -9
- package/types/range/test.f.mjs +1 -1
- package/types/range_map/module.f.d.mts +9 -15
- package/types/range_map/module.f.mjs +9 -18
- package/types/range_map/test.f.mjs +32 -32
- package/types/result/module.d.mts +3 -3
- package/types/result/module.f.d.mts +6 -12
- package/types/result/module.f.mjs +3 -12
- package/types/result/module.mjs +2 -2
- package/types/sorted_list/module.f.d.mts +22 -28
- package/types/sorted_list/module.f.mjs +10 -19
- package/types/sorted_list/test.f.mjs +7 -7
- package/types/sorted_set/module.f.d.mts +6 -12
- package/types/sorted_set/module.f.mjs +7 -16
- package/types/sorted_set/test.f.mjs +7 -7
- package/types/string/module.f.d.mts +8 -14
- package/types/string/module.f.mjs +10 -21
- package/types/string/test.f.mjs +2 -2
- package/types/string_set/module.f.d.mts +8 -16
- package/types/string_set/module.f.mjs +12 -27
- package/types/string_set/test.f.mjs +1 -1
package/types/btree/module.f.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @ts-self-types="./module.f.d.mts"
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import * as list from '../list/module.f.mjs'
|
|
4
4
|
const { flat } = list
|
|
5
|
-
import n from '../nullable/module.f.mjs'
|
|
5
|
+
import * as n from '../nullable/module.f.mjs'
|
|
6
6
|
const { map } = n
|
|
7
7
|
import * as _ from './types/module.f.mjs'
|
|
8
8
|
|
|
9
|
-
/** @type {<T>(node: _.Node<T>) =>
|
|
9
|
+
/** @type {<T>(node: _.Node<T>) => list.Thunk<T>} */
|
|
10
10
|
const nodeValues = node => () => {
|
|
11
11
|
switch (node.length) {
|
|
12
12
|
case 1: case 2: { return node }
|
|
@@ -29,12 +29,7 @@ const nodeValues = node => () => {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
const values = map(nodeValues)
|
|
32
|
+
export const empty = null
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
empty: null,
|
|
38
|
-
/** @readonly */
|
|
39
|
-
values,
|
|
40
|
-
}
|
|
34
|
+
/** @type {<T>(tree: _.Tree<T>) => list.List<T>} */
|
|
35
|
+
export const values = map(nodeValues)
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export default _default;
|
|
1
|
+
/** @type {<T>(c: Cmp.Compare<T>) => (node: _.Node<T>) => _.Tree<T>} */
|
|
2
|
+
export const nodeRemove: <T>(c: Cmp.Compare<T>) => (node: _.Node<T>) => _.Tree<T>;
|
|
3
|
+
/** @type {<T>(c: Cmp.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>} */
|
|
4
|
+
export const remove: <T>(c: Cmp.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>;
|
|
6
5
|
export type Leaf01<T> = null | _.Leaf1<T>;
|
|
7
6
|
export type RemovePath<T> = {
|
|
8
7
|
readonly first: Leaf01<T>;
|
|
9
|
-
readonly tail:
|
|
8
|
+
readonly tail: find.Path<T>;
|
|
10
9
|
};
|
|
11
10
|
export type Branch<T> = _.Branch1<T> | _.Branch3<T> | _.Branch5<T>;
|
|
12
11
|
export type Merge<A, T> = (a: A) => (n: _.Branch3<T>) => _.Branch1<T> | _.Branch3<T>;
|
|
13
|
-
/** @type {<T>(c: Cmp.Compare<T>) => (node: _.Node<T>) => _.Tree<T>} */
|
|
14
|
-
declare const nodeRemove: <T>(c: Cmp.Compare<T>) => (node: _.Node<T>) => _.Tree<T>;
|
|
15
|
-
/** @type {<T>(c: Cmp.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>} */
|
|
16
|
-
declare const remove: <T>(c: Cmp.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>;
|
|
17
|
-
import * as _ from '../types/module.f.mjs';
|
|
18
|
-
import * as Find from '../find/module.f.mjs';
|
|
19
12
|
import * as Cmp from '../../function/compare/module.f.mjs';
|
|
13
|
+
import * as _ from '../types/module.f.mjs';
|
|
14
|
+
import * as find from '../find/module.f.mjs';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @ts-self-types="./module.f.d.mts"
|
|
2
2
|
import * as _ from '../types/module.f.mjs'
|
|
3
3
|
import * as Cmp from '../../function/compare/module.f.mjs'
|
|
4
|
-
import
|
|
5
|
-
import list from '../../list/module.f.mjs'
|
|
4
|
+
import * as find from '../find/module.f.mjs'
|
|
5
|
+
import * as list from '../../list/module.f.mjs'
|
|
6
6
|
const { fold, concat, next } = list
|
|
7
7
|
import * as Array from '../../array/module.f.mjs'
|
|
8
|
-
import n from '../../nullable/module.f.mjs'
|
|
8
|
+
import * as n from '../../nullable/module.f.mjs'
|
|
9
9
|
const { map } = n
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -17,11 +17,11 @@ const { map } = n
|
|
|
17
17
|
* @template T
|
|
18
18
|
* @typedef {{
|
|
19
19
|
* readonly first: Leaf01<T>,
|
|
20
|
-
* readonly tail:
|
|
20
|
+
* readonly tail: find.Path<T>
|
|
21
21
|
* }} RemovePath
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
/** @type {<T>(tail:
|
|
24
|
+
/** @type {<T>(tail: find.Path<T>) => (n: _.Node<T>) => readonly[T, RemovePath<T>]} */
|
|
25
25
|
const path = tail => n => {
|
|
26
26
|
switch (n.length) {
|
|
27
27
|
case 1: { return [n[0], { first: null, tail }] }
|
|
@@ -95,7 +95,7 @@ const initValue1 = a => n => {
|
|
|
95
95
|
* @typedef {(a: A) => (n: _.Branch3<T>) => _.Branch1<T> | _.Branch3<T>} Merge
|
|
96
96
|
*/
|
|
97
97
|
|
|
98
|
-
/** @type {<A, T>(ms: Array.Array2<Merge<A, T>>) => (i:
|
|
98
|
+
/** @type {<A, T>(ms: Array.Array2<Merge<A, T>>) => (i: find.PathItem<T>) => (a: A) => Branch<T>} */
|
|
99
99
|
const reduceX = ms => ([i, n]) => a => {
|
|
100
100
|
const [m0, m2] = ms
|
|
101
101
|
/** @typedef {typeof ms extends Array.Array2<Merge<infer A, infer T>> ? [A,T] : never} AT */
|
|
@@ -118,14 +118,14 @@ const reduce = fold(reduceX([reduceValue0, reduceValue2]))
|
|
|
118
118
|
const initReduce = reduceX([initValue0, initValue1])
|
|
119
119
|
|
|
120
120
|
/** @type {<T>(c: Cmp.Compare<T>) => (node: _.Node<T>) => _.Tree<T>} */
|
|
121
|
-
const nodeRemove = c => node => {
|
|
121
|
+
export const nodeRemove = c => node => {
|
|
122
122
|
/** @typedef {typeof c extends Cmp.Compare<infer T> ? T : never} T */
|
|
123
123
|
/** @type {() => null | RemovePath<T>} */
|
|
124
124
|
const f = () => {
|
|
125
125
|
const { first, tail } = find.find(c)(node)
|
|
126
|
-
/** @type {(n: _.Node<T>) => (f: (v: T) =>
|
|
126
|
+
/** @type {(n: _.Node<T>) => (f: (v: T) => find.PathItem<T>) => RemovePath<T>} */
|
|
127
127
|
const branch = n => f => {
|
|
128
|
-
const [v, p] = path(/** @type {
|
|
128
|
+
const [v, p] = path(/** @type {find.Path<T>} */(null))(n)
|
|
129
129
|
return { first: p.first, tail: concat(p.tail)({ first: f(v), tail }) }
|
|
130
130
|
}
|
|
131
131
|
const [i, n] = first
|
|
@@ -158,11 +158,4 @@ const nodeRemove = c => node => {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
/** @type {<T>(c: Cmp.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>} */
|
|
161
|
-
const remove = c => map(nodeRemove(c))
|
|
162
|
-
|
|
163
|
-
export default {
|
|
164
|
-
/** @readonly */
|
|
165
|
-
nodeRemove,
|
|
166
|
-
/** @readonly */
|
|
167
|
-
remove,
|
|
168
|
-
}
|
|
161
|
+
export const remove = c => map(nodeRemove(c))
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import _ from './module.f.mjs'
|
|
1
|
+
import * as _ from './module.f.mjs'
|
|
2
2
|
import * as BTree from '../types/module.f.mjs'
|
|
3
|
-
import s from '../set/module.f.mjs'
|
|
4
|
-
import str from '../../string/module.f.mjs'
|
|
3
|
+
import * as s from '../set/module.f.mjs'
|
|
4
|
+
import * as str from '../../string/module.f.mjs'
|
|
5
5
|
const { cmp } = str
|
|
6
|
-
import json from '../../../json/module.f.mjs'
|
|
7
|
-
import o from '../../object/module.f.mjs'
|
|
6
|
+
import * as json from '../../../json/module.f.mjs'
|
|
7
|
+
import * as o from '../../object/module.f.mjs'
|
|
8
8
|
const { sort } = o
|
|
9
9
|
|
|
10
10
|
/** @type {(node: BTree.Node<string>) => (value: string) => BTree.Node<string>} */
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
export { set };
|
|
3
|
-
}
|
|
4
|
-
export default _default;
|
|
5
|
-
export type Branch1To3<T> = _.Branch1<T> | _.Branch3<T>;
|
|
6
1
|
/** @type {<T>(c: Cmp.Compare<T>) => (f: (value: T|null) => T) => (tree: _.Tree<T>) => _.Node<T>} */
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
export const set: <T>(c: Cmp.Compare<T>) => (f: (value: T | null) => T) => (tree: _.Tree<T>) => _.Node<T>;
|
|
3
|
+
export type Branch1To3<T> = _.Branch1<T> | _.Branch3<T>;
|
|
9
4
|
import * as Cmp from '../../function/compare/module.f.mjs';
|
|
5
|
+
import * as _ from '../types/module.f.mjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @ts-self-types="./module.f.d.mts"
|
|
2
2
|
import * as _ from '../types/module.f.mjs'
|
|
3
|
-
import
|
|
3
|
+
import * as btreeFind from '../find/module.f.mjs'
|
|
4
4
|
const { find } = btreeFind
|
|
5
5
|
import * as Cmp from '../../function/compare/module.f.mjs'
|
|
6
|
-
import list from '../../list/module.f.mjs'
|
|
6
|
+
import * as list from '../../list/module.f.mjs'
|
|
7
7
|
const { fold } = list
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -14,7 +14,7 @@ const { fold } = list
|
|
|
14
14
|
/** @type {<T>(b: _.Branch5<T> | _.Branch7<T>) => Branch1To3<T>} */
|
|
15
15
|
const b57 = b => b.length === 5 ? [b] : [[b[0], b[1], b[2]], b[3], [b[4], b[5], b[6]]]
|
|
16
16
|
|
|
17
|
-
/** @type {<T>(i:
|
|
17
|
+
/** @type {<T>(i: btreeFind.PathItem<T>) => (a: Branch1To3<T>) => Branch1To3<T>} */
|
|
18
18
|
const reduceOp = ([i, x]) => a => {
|
|
19
19
|
switch (i) {
|
|
20
20
|
case 0: {
|
|
@@ -89,9 +89,4 @@ const nodeSet = c => g => node => {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
/** @type {<T>(c: Cmp.Compare<T>) => (f: (value: T|null) => T) => (tree: _.Tree<T>) => _.Node<T>} */
|
|
92
|
-
const set = c => f => tree => tree === null ? [f(null)] : nodeSet(c)(f)(tree)
|
|
93
|
-
|
|
94
|
-
export default {
|
|
95
|
-
/** @readonly */
|
|
96
|
-
set,
|
|
97
|
-
}
|
|
92
|
+
export const set = c => f => tree => tree === null ? [f(null)] : nodeSet(c)(f)(tree)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import _ from './module.f.mjs'
|
|
1
|
+
import * as _ from './module.f.mjs'
|
|
2
2
|
import * as BTree from '../types/module.f.mjs'
|
|
3
|
-
import s from '../../string/module.f.mjs'
|
|
3
|
+
import * as s from '../../string/module.f.mjs'
|
|
4
4
|
const { cmp } = s
|
|
5
|
-
import json from '../../../json/module.f.mjs'
|
|
6
|
-
import o from '../../object/module.f.mjs'
|
|
5
|
+
import * as json from '../../../json/module.f.mjs'
|
|
6
|
+
import * as o from '../../object/module.f.mjs'
|
|
7
7
|
const { sort } = o
|
|
8
8
|
|
|
9
9
|
/** @type {(node: BTree.Node<string>) => (value: string) => BTree.Node<string>} */
|
package/types/btree/test.f.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as BTree from './types/module.f.mjs'
|
|
2
|
-
import _ from './module.f.mjs'
|
|
2
|
+
import * as _ from './module.f.mjs'
|
|
3
3
|
const { values } = _
|
|
4
|
-
import
|
|
5
|
-
import o from '../object/module.f.mjs'
|
|
4
|
+
import * as json from '../../json/module.f.mjs'
|
|
5
|
+
import * as o from '../object/module.f.mjs'
|
|
6
6
|
const { sort } = o
|
|
7
|
-
import str from '../string/module.f.mjs'
|
|
7
|
+
import * as str from '../string/module.f.mjs'
|
|
8
8
|
const { cmp } = str
|
|
9
|
-
import
|
|
10
|
-
import s from './set/module.f.mjs'
|
|
11
|
-
import f from './find/module.f.mjs'
|
|
9
|
+
import * as list from '../list/module.f.mjs'
|
|
10
|
+
import * as s from './set/module.f.mjs'
|
|
11
|
+
import * as f from './find/module.f.mjs'
|
|
12
12
|
|
|
13
13
|
const jsonStr = json.stringify(sort)
|
|
14
14
|
|
|
15
|
-
/** @type {(sequence:
|
|
15
|
+
/** @type {(sequence: list.List<json.Unknown>) => string} */
|
|
16
16
|
const stringify = sequence => jsonStr(list.toArray(sequence))
|
|
17
17
|
|
|
18
18
|
/** @type {(node: BTree.Node<string>) => (value: string) => BTree.Node<string>} */
|
|
@@ -67,7 +67,7 @@ const test = () => {
|
|
|
67
67
|
_map = set(_map)('f')
|
|
68
68
|
//
|
|
69
69
|
{
|
|
70
|
-
/** @type {
|
|
70
|
+
/** @type {list.Result<string>} */
|
|
71
71
|
let _item = list.next(values(_map))
|
|
72
72
|
while (_item !== null) {
|
|
73
73
|
_item = list.next(_item.tail)
|
|
@@ -1,38 +1,25 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
export { empty };
|
|
3
|
-
export { universe };
|
|
4
|
-
export { has };
|
|
5
|
-
export { set };
|
|
6
|
-
export { unset };
|
|
7
|
-
export { one };
|
|
8
|
-
export { union };
|
|
9
|
-
export { setRange };
|
|
10
|
-
export { range };
|
|
11
|
-
export { complement };
|
|
12
|
-
export { toRangeMap };
|
|
13
|
-
}
|
|
14
|
-
export default _default;
|
|
15
|
-
export type ByteSet = bigint;
|
|
16
|
-
export type Byte = number;
|
|
17
|
-
declare const empty: 0n;
|
|
18
|
-
declare const universe: 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn;
|
|
19
1
|
/** @typedef {bigint} ByteSet */
|
|
20
2
|
/** @typedef {number} Byte */
|
|
21
3
|
/** @type {(n: Byte) => (s: ByteSet) => boolean} */
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
declare const unset: (n: Byte) => (s: ByteSet) => ByteSet;
|
|
4
|
+
export const has: (n: Byte) => (s: ByteSet) => boolean;
|
|
5
|
+
export const empty: 0n;
|
|
6
|
+
export const universe: 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn;
|
|
26
7
|
/** @type {(n: Byte) => ByteSet} */
|
|
27
|
-
|
|
28
|
-
/** @type {(a: ByteSet) => (b: ByteSet) => ByteSet} */
|
|
29
|
-
declare const union: (a: ByteSet) => (b: ByteSet) => ByteSet;
|
|
30
|
-
declare const setRange: import("../function/module.f.mjs").Func<readonly [number, number], (b: ByteSet) => ByteSet>;
|
|
8
|
+
export const one: (n: Byte) => ByteSet;
|
|
31
9
|
/** @type {(r: readonly[Byte, Byte]) => ByteSet} */
|
|
32
|
-
|
|
10
|
+
export const range: (r: readonly [Byte, Byte]) => ByteSet;
|
|
11
|
+
/** @type {(a: ByteSet) => (b: ByteSet) => ByteSet} */
|
|
12
|
+
export const union: (a: ByteSet) => (b: ByteSet) => ByteSet;
|
|
33
13
|
/** @type {(n: ByteSet) => ByteSet} */
|
|
34
|
-
|
|
14
|
+
export const complement: (n: ByteSet) => ByteSet;
|
|
15
|
+
export const set: f.Func<number, (b: ByteSet) => ByteSet>;
|
|
16
|
+
export const setRange: f.Func<readonly [number, number], (b: ByteSet) => ByteSet>;
|
|
17
|
+
/** @type {(n: Byte) => (s: ByteSet) => ByteSet} */
|
|
18
|
+
export const unset: (n: Byte) => (s: ByteSet) => ByteSet;
|
|
35
19
|
/** @type {(n: ByteSet) => (s: string) => RangeMap.RangeMap<SortedSet.SortedSet<string>>} */
|
|
36
|
-
|
|
20
|
+
export const toRangeMap: (n: ByteSet) => (s: string) => RangeMap.RangeMap<SortedSet.SortedSet<string>>;
|
|
21
|
+
export type ByteSet = bigint;
|
|
22
|
+
export type Byte = number;
|
|
23
|
+
import * as f from '../function/module.f.mjs';
|
|
37
24
|
import * as RangeMap from '../range_map/module.f.mjs';
|
|
38
25
|
import * as SortedSet from '../sorted_set/module.f.mjs';
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
// @ts-self-types="./module.f.d.mts"
|
|
2
|
-
import f from '../function/module.f.mjs'
|
|
2
|
+
import * as f from '../function/module.f.mjs'
|
|
3
3
|
const { compose } = f
|
|
4
4
|
import * as RangeMap from '../range_map/module.f.mjs'
|
|
5
5
|
import * as SortedSet from '../sorted_set/module.f.mjs'
|
|
6
|
-
import list from '../list/module.f.mjs'
|
|
6
|
+
import * as list from '../list/module.f.mjs'
|
|
7
7
|
const { reverse, countdown, flat, map } = list
|
|
8
8
|
|
|
9
9
|
/** @typedef {bigint} ByteSet */
|
|
10
10
|
/** @typedef {number} Byte */
|
|
11
11
|
|
|
12
12
|
/** @type {(n: Byte) => (s: ByteSet) => boolean} */
|
|
13
|
-
const has = n => s => ((s >> BigInt(n)) & 1n) === 1n
|
|
13
|
+
export const has = n => s => ((s >> BigInt(n)) & 1n) === 1n
|
|
14
14
|
|
|
15
15
|
// create a set
|
|
16
16
|
|
|
17
|
-
const empty = 0n
|
|
17
|
+
export const empty = 0n
|
|
18
18
|
|
|
19
|
-
//
|
|
20
|
-
const universe = 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFFn
|
|
19
|
+
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
|
20
|
+
export const universe = 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFFn
|
|
21
21
|
|
|
22
22
|
/** @type {(n: Byte) => ByteSet} */
|
|
23
|
-
const one = n => 1n << BigInt(n)
|
|
23
|
+
export const one = n => 1n << BigInt(n)
|
|
24
24
|
|
|
25
25
|
/** @type {(r: readonly[Byte, Byte]) => ByteSet} */
|
|
26
|
-
const range = ([b, e]) => one(e - b + 1) - 1n << BigInt(b)
|
|
26
|
+
export const range = ([b, e]) => one(e - b + 1) - 1n << BigInt(b)
|
|
27
27
|
|
|
28
28
|
// set operations
|
|
29
29
|
|
|
30
30
|
/** @type {(a: ByteSet) => (b: ByteSet) => ByteSet} */
|
|
31
|
-
const union = a => b => a | b
|
|
31
|
+
export const union = a => b => a | b
|
|
32
32
|
|
|
33
33
|
/** @type {(a: ByteSet) => (b: ByteSet) => ByteSet} */
|
|
34
34
|
const intersect = a => b => a & b
|
|
35
35
|
|
|
36
36
|
/** @type {(n: ByteSet) => ByteSet} */
|
|
37
|
-
const complement = n => universe ^ n
|
|
37
|
+
export const complement = n => universe ^ n
|
|
38
38
|
|
|
39
39
|
/** @type {(a: ByteSet) => (b: ByteSet) => ByteSet} */
|
|
40
40
|
const difference = compose(intersect)(compose(complement))
|
|
41
41
|
|
|
42
42
|
// additional operations
|
|
43
43
|
|
|
44
|
-
const set = compose(one)(union)
|
|
44
|
+
export const set = compose(one)(union)
|
|
45
45
|
|
|
46
|
-
const setRange = compose(range)(union)
|
|
46
|
+
export const setRange = compose(range)(union)
|
|
47
47
|
|
|
48
48
|
/** @type {(n: Byte) => (s: ByteSet) => ByteSet} */
|
|
49
|
-
const unset = n => s => difference(s)(one(n))
|
|
49
|
+
export const unset = n => s => difference(s)(one(n))
|
|
50
50
|
|
|
51
51
|
const counter = reverse(countdown(256))
|
|
52
52
|
|
|
@@ -58,29 +58,4 @@ const toRangeMapOp = n => s => i => {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/** @type {(n: ByteSet) => (s: string) => RangeMap.RangeMap<SortedSet.SortedSet<string>>} */
|
|
61
|
-
const toRangeMap = n => s => flat(map(toRangeMapOp(n)(s))(counter))
|
|
62
|
-
|
|
63
|
-
export default {
|
|
64
|
-
/** @readonly */
|
|
65
|
-
empty,
|
|
66
|
-
/** @readonly */
|
|
67
|
-
universe,
|
|
68
|
-
/** @readonly */
|
|
69
|
-
has,
|
|
70
|
-
/** @readonly */
|
|
71
|
-
set,
|
|
72
|
-
/** @readonly */
|
|
73
|
-
unset,
|
|
74
|
-
/** @readonly */
|
|
75
|
-
one,
|
|
76
|
-
/** @readonly */
|
|
77
|
-
union,
|
|
78
|
-
/** @readonly */
|
|
79
|
-
setRange,
|
|
80
|
-
/** @readonly */
|
|
81
|
-
range,
|
|
82
|
-
/** @readonly */
|
|
83
|
-
complement,
|
|
84
|
-
/** @readonly */
|
|
85
|
-
toRangeMap,
|
|
86
|
-
}
|
|
61
|
+
export const toRangeMap = n => s => flat(map(toRangeMapOp(n)(s))(counter))
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import _ from './module.f.mjs'
|
|
2
|
-
import list from '../list/module.f.mjs'
|
|
1
|
+
import * as _ from './module.f.mjs'
|
|
2
|
+
import * as list from '../list/module.f.mjs'
|
|
3
3
|
const { every, countdown, map, toArray } = list
|
|
4
|
-
import
|
|
5
|
-
import o from '../object/module.f.mjs'
|
|
4
|
+
import * as json from '../../json/module.f.mjs'
|
|
5
|
+
import * as o from '../object/module.f.mjs'
|
|
6
6
|
const { sort } = o
|
|
7
7
|
|
|
8
|
-
/** @type {(a: readonly
|
|
8
|
+
/** @type {(a: readonly json.Unknown[]) => string} */
|
|
9
9
|
const stringify = json.stringify(sort)
|
|
10
10
|
|
|
11
11
|
export default {
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
export { unsafeCmp };
|
|
3
|
-
export { index3 };
|
|
4
|
-
export { index5 };
|
|
5
|
-
}
|
|
6
|
-
export default _default;
|
|
7
|
-
export type Index3 = Array.Index3;
|
|
8
|
-
export type Index5 = Array.Index5;
|
|
9
|
-
export type Array2<T> = Array.Array2<T>;
|
|
10
|
-
export type Sign = -1 | 0 | 1;
|
|
11
|
-
export type Compare<T> = (_: T) => Sign;
|
|
12
|
-
/** @type {<T>(a: T) => (b: T) => Sign} */
|
|
13
|
-
declare const unsafeCmp: <T>(a: T) => (b: T) => Sign;
|
|
14
1
|
/** @typedef {Array.Index3} Index3 */
|
|
15
2
|
/** @typedef {Array.Index5} Index5 */
|
|
16
3
|
/**
|
|
@@ -23,7 +10,14 @@ declare const unsafeCmp: <T>(a: T) => (b: T) => Sign;
|
|
|
23
10
|
* @typedef {(_: T) => Sign} Compare
|
|
24
11
|
*/
|
|
25
12
|
/** @type {<T>(cmp: Compare<T>) => (value: T) => Index3} */
|
|
26
|
-
|
|
13
|
+
export const index3: <T>(cmp: Compare<T>) => (value: T) => Index3;
|
|
27
14
|
/** @type {<T>(cmp: Compare<T>) => (v2: Array2<T>) => Index5} */
|
|
28
|
-
|
|
15
|
+
export const index5: <T>(cmp: Compare<T>) => (v2: Array2<T>) => Index5;
|
|
16
|
+
/** @type {<T>(a: T) => (b: T) => Sign} */
|
|
17
|
+
export const unsafeCmp: <T>(a: T) => (b: T) => Sign;
|
|
18
|
+
export type Index3 = Array.Index3;
|
|
19
|
+
export type Index5 = Array.Index5;
|
|
20
|
+
export type Array2<T> = Array.Array2<T>;
|
|
21
|
+
export type Sign = -1 | 0 | 1;
|
|
22
|
+
export type Compare<T> = (_: T) => Sign;
|
|
29
23
|
import * as Array from '../../array/module.f.mjs';
|
|
@@ -17,22 +17,13 @@ import * as Array from '../../array/module.f.mjs'
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
/** @type {<T>(cmp: Compare<T>) => (value: T) => Index3} */
|
|
20
|
-
const index3 = cmp => value => /** @type {Index3} */ (cmp(value) + 1)
|
|
20
|
+
export const index3 = cmp => value => /** @type {Index3} */ (cmp(value) + 1)
|
|
21
21
|
|
|
22
22
|
/** @type {<T>(cmp: Compare<T>) => (v2: Array2<T>) => Index5} */
|
|
23
|
-
const index5 = cmp => ([v0, v1]) => {
|
|
23
|
+
export const index5 = cmp => ([v0, v1]) => {
|
|
24
24
|
const _0 = cmp(v0)
|
|
25
25
|
return /** @type {Index5} */ (_0 <= 0 ? _0 + 1 : cmp(v1) + 3)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/** @type {<T>(a: T) => (b: T) => Sign} */
|
|
29
|
-
const unsafeCmp = a => b => a < b ? -1 : a > b ? 1 : 0
|
|
30
|
-
|
|
31
|
-
export default {
|
|
32
|
-
/** @readonly */
|
|
33
|
-
unsafeCmp,
|
|
34
|
-
/** @readonly */
|
|
35
|
-
index3,
|
|
36
|
-
/** @readonly */
|
|
37
|
-
index5,
|
|
38
|
-
}
|
|
29
|
+
export const unsafeCmp = a => b => a < b ? -1 : a > b ? 1 : 0
|
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
export { identity };
|
|
3
|
-
export { compose };
|
|
4
|
-
export { flip };
|
|
5
|
-
export { fn };
|
|
6
|
-
}
|
|
7
|
-
export default _default;
|
|
8
|
-
/**
|
|
9
|
-
* A generic function type.
|
|
10
|
-
*/
|
|
11
|
-
export type Func<I, O> = (_: I) => O;
|
|
12
|
-
/**
|
|
13
|
-
* A functional utility type that enables seamless chaining of transformations.
|
|
14
|
-
*/
|
|
15
|
-
export type Fn<I, O> = {
|
|
16
|
-
readonly result: Func<I, O>;
|
|
17
|
-
readonly then: <T>(g: Func<O, T>) => Fn<I, T>;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* A generic identity function.
|
|
21
|
-
*
|
|
22
|
-
* @type {<T>(value: T) => T}
|
|
23
|
-
*/
|
|
24
|
-
declare const identity: <T>(value: T) => T;
|
|
25
1
|
/**
|
|
26
2
|
* A generic function type.
|
|
27
3
|
*
|
|
@@ -34,13 +10,19 @@ declare const identity: <T>(value: T) => T;
|
|
|
34
10
|
*
|
|
35
11
|
* @type {<I, X>(g: Func<I, X>) => <O>(f: Func<X, O>) => Func<I, O>}
|
|
36
12
|
*/
|
|
37
|
-
|
|
13
|
+
export const compose: <I, X>(g: Func<I, X>) => <O>(f: Func<X, O>) => Func<I, O>;
|
|
14
|
+
/**
|
|
15
|
+
* A generic identity function.
|
|
16
|
+
*
|
|
17
|
+
* @type {<T>(value: T) => T}
|
|
18
|
+
*/
|
|
19
|
+
export const identity: <T>(value: T) => T;
|
|
38
20
|
/**
|
|
39
21
|
* Flips the arguments of a curried function.
|
|
40
22
|
*
|
|
41
23
|
* @type {<A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C}
|
|
42
24
|
*/
|
|
43
|
-
|
|
25
|
+
export const flip: <A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C;
|
|
44
26
|
/**
|
|
45
27
|
* A functional utility type that enables seamless chaining of transformations.
|
|
46
28
|
*
|
|
@@ -55,4 +37,15 @@ declare const flip: <A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C
|
|
|
55
37
|
*
|
|
56
38
|
* @type {<I, O>(f: (i: I) => O) => Fn<I, O>}
|
|
57
39
|
*/
|
|
58
|
-
|
|
40
|
+
export const fn: <I, O>(f: (i: I) => O) => Fn<I, O>;
|
|
41
|
+
/**
|
|
42
|
+
* A generic function type.
|
|
43
|
+
*/
|
|
44
|
+
export type Func<I, O> = (_: I) => O;
|
|
45
|
+
/**
|
|
46
|
+
* A functional utility type that enables seamless chaining of transformations.
|
|
47
|
+
*/
|
|
48
|
+
export type Fn<I, O> = {
|
|
49
|
+
readonly result: Func<I, O>;
|
|
50
|
+
readonly then: <T>(g: Func<O, T>) => Fn<I, T>;
|
|
51
|
+
};
|
|
@@ -13,21 +13,21 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @type {<I, X>(g: Func<I, X>) => <O>(f: Func<X, O>) => Func<I, O>}
|
|
15
15
|
*/
|
|
16
|
-
const compose = g => f => x => f(g(x))
|
|
16
|
+
export const compose = g => f => x => f(g(x))
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* A generic identity function.
|
|
20
20
|
*
|
|
21
21
|
* @type {<T>(value: T) => T}
|
|
22
22
|
*/
|
|
23
|
-
const identity = value => value
|
|
23
|
+
export const identity = value => value
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Flips the arguments of a curried function.
|
|
27
27
|
*
|
|
28
28
|
* @type {<A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C}
|
|
29
29
|
*/
|
|
30
|
-
const flip = f => b => a => f(a)(b)
|
|
30
|
+
export const flip = f => b => a => f(a)(b)
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* A functional utility type that enables seamless chaining of transformations.
|
|
@@ -44,18 +44,7 @@ const flip = f => b => a => f(a)(b)
|
|
|
44
44
|
*
|
|
45
45
|
* @type {<I, O>(f: (i: I) => O) => Fn<I, O>}
|
|
46
46
|
*/
|
|
47
|
-
const fn = result => ({
|
|
47
|
+
export const fn = result => ({
|
|
48
48
|
result,
|
|
49
49
|
then: g => fn(compose(result)(g))
|
|
50
50
|
})
|
|
51
|
-
|
|
52
|
-
export default {
|
|
53
|
-
/** @readonly */
|
|
54
|
-
identity,
|
|
55
|
-
/** @readonly */
|
|
56
|
-
compose,
|
|
57
|
-
/** @readonly */
|
|
58
|
-
flip,
|
|
59
|
-
/** @readonly */
|
|
60
|
-
fn,
|
|
61
|
-
}
|