functionalscript 0.1.594 → 0.1.596
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/.github/workflows/npm-publish.yml +2 -1
- package/com/cpp/module.f.d.mts +8 -0
- package/com/cpp/test.f.d.mts +2 -0
- package/com/cpp/testlib.f.d.mts +2 -0
- package/com/cs/module.f.d.mts +8 -0
- package/com/cs/test.f.d.mts +2 -0
- package/com/cs/testlib.f.d.mts +2 -0
- package/com/rust/module.f.d.mts +28 -0
- package/com/rust/test.f.d.mts +2 -0
- package/com/rust/testlib.f.d.mts +2 -0
- package/com/test/build.d.mts +1 -0
- package/com/test/build.f.d.mts +26 -0
- package/com/types/module.f.d.mts +28 -0
- package/com/types/testlib.f.d.mts +44 -0
- package/commonjs/build/module.f.d.mts +24 -0
- package/commonjs/build/test.f.d.mts +3 -0
- package/commonjs/module/function/module.f.d.mts +7 -0
- package/commonjs/module/module.f.d.mts +57 -0
- package/commonjs/module.d.mts +7 -0
- package/commonjs/module.f.d.mts +4 -0
- package/commonjs/package/dependencies/module.f.d.mts +10 -0
- package/commonjs/package/dependencies/test.f.d.mts +2 -0
- package/commonjs/package/module.f.d.mts +27 -0
- package/commonjs/package/test.f.d.mts +2 -0
- package/commonjs/path/module.f.d.mts +67 -0
- package/commonjs/path/test.f.d.mts +25 -0
- package/commonjs/test.d.mts +8 -0
- package/dev/index.d.mts +1 -0
- package/dev/module.d.mts +26 -0
- package/dev/module.f.d.mts +4 -0
- package/dev/test/module.f.d.mts +26 -0
- package/dev/test.d.mts +3 -0
- package/dev/test.f.d.mts +9 -0
- package/djs/module.f.d.mts +25 -0
- package/djs/parser/module.f.d.mts +40 -0
- package/djs/parser/test.f.d.mts +8 -0
- package/djs/test.f.d.mts +12 -0
- package/djs/tokenizer/module.f.d.mts +17 -0
- package/djs/tokenizer/test.f.d.mts +6 -0
- package/fsc/module.f.d.mts +12 -0
- package/fsc/test.f.d.mts +4 -0
- package/fsm/module.f.d.mts +21 -0
- package/fsm/test.f.d.mts +5 -0
- package/html/module.f.d.mts +20 -0
- package/html/test.f.d.mts +10 -0
- package/index.f.d.mts +83 -0
- package/js/tokenizer/module.f.d.mts +150 -0
- package/js/tokenizer/test.f.d.mts +8 -0
- package/json/module.f.d.mts +41 -0
- package/json/parser/module.f.d.mts +36 -0
- package/json/parser/test.f.d.mts +5 -0
- package/json/serializer/module.f.d.mts +45 -0
- package/json/serializer/test.f.d.mts +8 -0
- package/json/test.f.d.mts +8 -0
- package/json/tokenizer/module.f.d.mts +17 -0
- package/json/tokenizer/test.f.d.mts +6 -0
- package/jsr.json +1 -1
- package/nodejs/version/main.d.mts +1 -0
- package/nodejs/version/module.f.d.mts +18 -0
- package/nodejs/version/test.f.d.mts +2 -0
- package/package.json +2 -1
- package/prime_field/module.f.d.mts +44 -0
- package/prime_field/test.f.d.mts +12 -0
- package/secp/module.f.d.mts +49 -0
- package/secp/test.f.d.mts +4 -0
- package/sha2/module.f.d.mts +23 -0
- package/sha2/test.f.d.mts +10 -0
- package/text/ascii/module.f.d.mts +73 -0
- package/text/ascii/test.f.d.mts +4 -0
- package/text/module.f.d.mts +18 -0
- package/text/sgr/module.f.d.mts +14 -0
- package/text/test.f.d.mts +2 -0
- package/text/utf16/module.f.d.mts +19 -0
- package/text/utf16/test.f.d.mts +6 -0
- package/text/utf8/module.f.d.mts +15 -0
- package/text/utf8/test.f.d.mts +6 -0
- package/types/array/module.f.d.mts +41 -0
- package/types/array/test.f.d.mts +10 -0
- package/types/bigfloat/module.f.d.mts +11 -0
- package/types/bigfloat/test.f.d.mts +6 -0
- package/types/bigint/module.f.d.mts +77 -0
- package/types/bigint/test.f.d.mts +16 -0
- package/types/btree/find/module.f.d.mts +42 -0
- package/types/btree/find/test.f.d.mts +2 -0
- package/types/btree/module.f.d.mts +9 -0
- package/types/btree/remove/module.f.d.mts +19 -0
- package/types/btree/remove/test.f.d.mts +7 -0
- package/types/btree/set/module.f.d.mts +9 -0
- package/types/btree/set/test.f.d.mts +2 -0
- package/types/btree/test.f.d.mts +13 -0
- package/types/btree/types/module.f.d.mts +16 -0
- package/types/byte_set/module.f.d.mts +38 -0
- package/types/byte_set/test.f.d.mts +13 -0
- package/types/function/compare/module.f.d.mts +29 -0
- package/types/function/compare/test.f.d.mts +2 -0
- package/types/function/module.f.d.mts +36 -0
- package/types/function/operator/module.f.d.mts +75 -0
- package/types/function/test.f.d.mts +2 -0
- package/types/list/module.f.d.mts +117 -0
- package/types/list/test.f.d.mts +38 -0
- package/types/map/module.f.d.mts +30 -0
- package/types/map/test.f.d.mts +5 -0
- package/types/nibble_set/module.f.d.mts +26 -0
- package/types/nibble_set/test.f.d.mts +13 -0
- package/types/nullable/module.f.d.mts +14 -0
- package/types/nullable/test.f.d.mts +2 -0
- package/types/number/module.f.d.mts +13 -0
- package/types/number/test.f.d.mts +11 -0
- package/types/object/module.f.d.mts +29 -0
- package/types/object/test.f.d.mts +5 -0
- package/types/range/module.f.d.mts +11 -0
- package/types/range/test.f.d.mts +2 -0
- package/types/range_map/module.f.d.mts +25 -0
- package/types/range_map/test.f.d.mts +6 -0
- package/types/result/module.d.mts +7 -0
- package/types/result/module.f.d.mts +28 -0
- package/types/sorted_list/module.f.d.mts +59 -0
- package/types/sorted_list/test.f.d.mts +5 -0
- package/types/sorted_set/module.f.d.mts +25 -0
- package/types/sorted_set/test.f.d.mts +6 -0
- package/types/string/module.f.d.mts +15 -0
- package/types/string/test.f.d.mts +15 -0
- package/types/string_set/module.f.d.mts +21 -0
- package/types/string_set/test.f.d.mts +5 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { padding };
|
|
3
|
+
export { computeSha256 };
|
|
4
|
+
export { computeSha224 };
|
|
5
|
+
export { compress256 };
|
|
6
|
+
export { compress224 };
|
|
7
|
+
}
|
|
8
|
+
export default _default;
|
|
9
|
+
export type HashInput = {
|
|
10
|
+
readonly f: (i: number) => number;
|
|
11
|
+
readonly length: number;
|
|
12
|
+
};
|
|
13
|
+
export type Hash8 = arrayT.Array8<number>;
|
|
14
|
+
export type Array16 = arrayT.Array16<number>;
|
|
15
|
+
/** @type {(input: readonly number[]) => (bits: number) => HashInput} */
|
|
16
|
+
declare const padding: (input: readonly number[]) => (bits: number) => HashInput;
|
|
17
|
+
/** @type {(input: readonly number[]) => (bitsCount: number) => Hash8} */
|
|
18
|
+
declare const computeSha256: (input: readonly number[]) => (bitsCount: number) => Hash8;
|
|
19
|
+
/** @type {(input: readonly number[]) => (bitsCount: number) => Hash8} */
|
|
20
|
+
declare const computeSha224: (input: readonly number[]) => (bitsCount: number) => Hash8;
|
|
21
|
+
declare const compress256: (data: Array16) => Hash8;
|
|
22
|
+
declare const compress224: (data: Array16) => Hash8;
|
|
23
|
+
import * as arrayT from '../types/array/module.f.mjs';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { one };
|
|
3
|
+
export { range };
|
|
4
|
+
export let backspace: number;
|
|
5
|
+
export let ht: number;
|
|
6
|
+
export let lf: number;
|
|
7
|
+
export let ff: number;
|
|
8
|
+
export let cr: number;
|
|
9
|
+
export let space: number;
|
|
10
|
+
export let exclamationMark: number;
|
|
11
|
+
export let quotationMark: number;
|
|
12
|
+
export let numberSign: number;
|
|
13
|
+
export let dollarSign: number;
|
|
14
|
+
export let percentSign: number;
|
|
15
|
+
export let ampersand: number;
|
|
16
|
+
export let apostrophe: number;
|
|
17
|
+
export let leftParenthesis: number;
|
|
18
|
+
export let rightParenthesis: number;
|
|
19
|
+
export let asterisk: number;
|
|
20
|
+
export let plusSign: number;
|
|
21
|
+
export let comma: number;
|
|
22
|
+
export let hyphenMinus: number;
|
|
23
|
+
export let fullStop: number;
|
|
24
|
+
export let solidus: number;
|
|
25
|
+
export let digitRange: Range.Range;
|
|
26
|
+
export let digit0: number;
|
|
27
|
+
export let digit1: number;
|
|
28
|
+
export let digit2: number;
|
|
29
|
+
export let digit3: number;
|
|
30
|
+
export let digit4: number;
|
|
31
|
+
export let digit5: number;
|
|
32
|
+
export let digit6: number;
|
|
33
|
+
export let digit7: number;
|
|
34
|
+
export let digit8: number;
|
|
35
|
+
export let digit9: number;
|
|
36
|
+
export let colon: number;
|
|
37
|
+
export let semicolon: number;
|
|
38
|
+
export let lessThanSign: number;
|
|
39
|
+
export let equalsSign: number;
|
|
40
|
+
export let greaterThanSign: number;
|
|
41
|
+
export let questionMark: number;
|
|
42
|
+
export let commercialAt: number;
|
|
43
|
+
export let latinCapitalLetterRange: Range.Range;
|
|
44
|
+
export let latinCapitalLetterA: number;
|
|
45
|
+
export let latinCapitalLetterE: number;
|
|
46
|
+
export let latinCapitalLetterF: number;
|
|
47
|
+
export let leftSquareBracket: number;
|
|
48
|
+
export let reverseSolidus: number;
|
|
49
|
+
export let rightSquareBracket: number;
|
|
50
|
+
export let circumflexAccent: number;
|
|
51
|
+
export let lowLine: number;
|
|
52
|
+
export let graveAccent: number;
|
|
53
|
+
export let latinSmallLetterRange: Range.Range;
|
|
54
|
+
export let latinSmallLetterA: number;
|
|
55
|
+
export let latinSmallLetterB: number;
|
|
56
|
+
export let latinSmallLetterE: number;
|
|
57
|
+
export let latinSmallLetterF: number;
|
|
58
|
+
export let latinSmallLetterN: number;
|
|
59
|
+
export let latinSmallLetterR: number;
|
|
60
|
+
export let latinSmallLetterT: number;
|
|
61
|
+
export let latinSmallLetterU: number;
|
|
62
|
+
export let latinSmallLetterZ: number;
|
|
63
|
+
export let leftCurlyBracket: number;
|
|
64
|
+
export let verticalLine: number;
|
|
65
|
+
export let rightCurlyBracket: number;
|
|
66
|
+
export let tilde: number;
|
|
67
|
+
}
|
|
68
|
+
export default _default;
|
|
69
|
+
/** @type {(s: string) => number} */
|
|
70
|
+
declare const one: (s: string) => number;
|
|
71
|
+
/** @type {(s: string) => Range.Range} */
|
|
72
|
+
declare const range: (s: string) => Range.Range;
|
|
73
|
+
import * as Range from '../../types/range/module.f.mjs';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { flat };
|
|
3
|
+
export { curly };
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
6
|
+
export type Block = ItemThunk | ItemArray;
|
|
7
|
+
export type ItemArray = readonly Item[];
|
|
8
|
+
export type ItemThunk = () => List.List<Item>;
|
|
9
|
+
export type Item = string | ItemArray | ItemThunk;
|
|
10
|
+
/** @typedef {ItemThunk|ItemArray} Block */
|
|
11
|
+
/** @typedef {readonly Item[]} ItemArray */
|
|
12
|
+
/** @typedef {() => List.List<Item>} ItemThunk */
|
|
13
|
+
/** @typedef {string|ItemArray|ItemThunk} Item */
|
|
14
|
+
/** @type {(indent: string) => (text: Block) => List.List<string>} */
|
|
15
|
+
declare const flat: (indent: string) => (text: Block) => List.List<string>;
|
|
16
|
+
/** @type {(type: string) => (name: string) => (body: Block) => Block} */
|
|
17
|
+
declare const curly: (type: string) => (name: string) => (body: Block) => Block;
|
|
18
|
+
import * as List from '../types/list/module.f.mjs';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { sgr };
|
|
3
|
+
export let reset: string;
|
|
4
|
+
export let bold: string;
|
|
5
|
+
export let fgRed: string;
|
|
6
|
+
export let fgGreen: string;
|
|
7
|
+
}
|
|
8
|
+
export default _default;
|
|
9
|
+
/**
|
|
10
|
+
* https://en.wikipedia.org/wiki/ANSI_escape_code#SGR
|
|
11
|
+
*
|
|
12
|
+
* @type {(c: number) => string}
|
|
13
|
+
*/
|
|
14
|
+
declare const sgr: (c: number) => string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { fromCodePointList };
|
|
3
|
+
export { toCodePointList };
|
|
4
|
+
export { stringToList };
|
|
5
|
+
export { listToString };
|
|
6
|
+
}
|
|
7
|
+
export default _default;
|
|
8
|
+
export type WordOrEof = u16 | null;
|
|
9
|
+
export type Utf16State = number | null;
|
|
10
|
+
export type u16 = number;
|
|
11
|
+
export type i32 = number;
|
|
12
|
+
declare const fromCodePointList: (input: List.List<number>) => List.Thunk<number>;
|
|
13
|
+
/** @type {(input: List.List<u16>) => List.List<i32>} */
|
|
14
|
+
declare const toCodePointList: (input: List.List<u16>) => List.List<i32>;
|
|
15
|
+
/** @type {(s: string) => List.List<u16>} */
|
|
16
|
+
declare const stringToList: (s: string) => List.List<u16>;
|
|
17
|
+
/** @type {(input: List.List<u16>) => string} */
|
|
18
|
+
declare const listToString: (input: List.List<u16>) => string;
|
|
19
|
+
import * as List from '../../types/list/module.f.mjs';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { fromCodePointList };
|
|
3
|
+
export { toCodePointList };
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
6
|
+
export type ByteOrEof = u8 | null;
|
|
7
|
+
export type Utf8NonEmptyState = arrayT.Array1<number> | arrayT.Array2<number> | arrayT.Array3<number>;
|
|
8
|
+
export type Utf8State = null | Utf8NonEmptyState;
|
|
9
|
+
export type u8 = number;
|
|
10
|
+
export type i32 = number;
|
|
11
|
+
declare const fromCodePointList: (input: List.List<number>) => List.Thunk<number>;
|
|
12
|
+
/** @type {(input: List.List<u8>) => List.List<i32>} */
|
|
13
|
+
declare const toCodePointList: (input: List.List<u8>) => List.List<i32>;
|
|
14
|
+
import * as arrayT from '../../types/array/module.f.mjs';
|
|
15
|
+
import * as List from '../../types/list/module.f.mjs';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { at };
|
|
3
|
+
export { first };
|
|
4
|
+
export { last };
|
|
5
|
+
export { head };
|
|
6
|
+
export { tail };
|
|
7
|
+
export { splitFirst };
|
|
8
|
+
export { splitLast };
|
|
9
|
+
}
|
|
10
|
+
export default _default;
|
|
11
|
+
export type Array1<T> = readonly [T];
|
|
12
|
+
export type Index1 = 0;
|
|
13
|
+
export type Array2<T> = readonly [T, T];
|
|
14
|
+
export type Tuple2<T0, T1> = readonly [T0, T1];
|
|
15
|
+
export type Index2 = 0 | 1;
|
|
16
|
+
export type Array3<T> = readonly [T, T, T];
|
|
17
|
+
export type Tuple3<T0, T1, T2> = readonly [T0, T1, T2];
|
|
18
|
+
export type Index3 = 0 | 1 | 2;
|
|
19
|
+
export type Array4<T> = readonly [T, T, T, T];
|
|
20
|
+
export type Index4 = 0 | 1 | 2 | 3;
|
|
21
|
+
export type Array5<T> = readonly [T, T, T, T, T];
|
|
22
|
+
export type Array8<T> = readonly [T, T, T, T, T, T, T, T];
|
|
23
|
+
export type Array16<T> = readonly [T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T];
|
|
24
|
+
export type Index16 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
|
|
25
|
+
export type Array1_5<T> = Array1<T> | Array2<T> | Array3<T> | Array4<T> | Array5<T>;
|
|
26
|
+
export type Index5 = 0 | 1 | 2 | 3 | 4;
|
|
27
|
+
export type KeyOf<T> = T extends Array1<infer _> ? Index1 : T extends Array2<infer _> ? Index2 : T extends Array3<infer _> ? Index3 : T extends Array4<infer _> ? Index4 : T extends Array5<infer _> ? Index5 : T extends readonly (infer _)[] ? number : never;
|
|
28
|
+
/** @type {(index: number) => <T>(a: readonly T[]) => T|null} */
|
|
29
|
+
declare const at: (index: number) => <T>(a: readonly T[]) => T | null;
|
|
30
|
+
/** @type {<T>(_: readonly T[]) => T|null} */
|
|
31
|
+
declare const first: <T>(_: readonly T[]) => T | null;
|
|
32
|
+
/** @type {<T>(_: readonly T[]) => T|null} */
|
|
33
|
+
declare const last: <T>(_: readonly T[]) => T | null;
|
|
34
|
+
/** @type {<T>(_: readonly T[]) => readonly T[]|null} */
|
|
35
|
+
declare const head: <T>(_: readonly T[]) => readonly T[] | null;
|
|
36
|
+
/** @type {<T>(_: readonly T[]) => readonly T[] | null} */
|
|
37
|
+
declare const tail: <T>(_: readonly T[]) => readonly T[] | null;
|
|
38
|
+
/** @type {<T>(_: readonly T[]) => readonly[T, readonly T[]]|null} */
|
|
39
|
+
declare const splitFirst: <T>(_: readonly T[]) => readonly [T, readonly T[]] | null;
|
|
40
|
+
/** @type {<T>(_: readonly T[]) => readonly[readonly T[], T]|null} */
|
|
41
|
+
declare const splitLast: <T>(_: readonly T[]) => readonly [readonly T[], T] | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
function stringify(): void;
|
|
3
|
+
let at: (() => void)[];
|
|
4
|
+
let first: (() => void)[];
|
|
5
|
+
let last: (() => void)[];
|
|
6
|
+
let head: (() => void)[];
|
|
7
|
+
let tail: (() => void)[];
|
|
8
|
+
let splitFirst: (() => void)[];
|
|
9
|
+
}
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { decToBin };
|
|
3
|
+
export { multiply };
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
6
|
+
export type BigFloat = readonly [bigint, number];
|
|
7
|
+
export type BigFloatWithRemainder = readonly [BigFloat, bigint];
|
|
8
|
+
/** @type {(dec: BigFloat) => BigFloat} */
|
|
9
|
+
declare const decToBin: (dec: BigFloat) => BigFloat;
|
|
10
|
+
/** @type {(b: BigFloat) => (mul: bigint) => BigFloat} */
|
|
11
|
+
declare const multiply: (b: BigFloat) => (mul: bigint) => BigFloat;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { addition };
|
|
3
|
+
export { sum };
|
|
4
|
+
export { abs };
|
|
5
|
+
export { sign };
|
|
6
|
+
export { serialize };
|
|
7
|
+
export { scalar_mul };
|
|
8
|
+
export { log2 };
|
|
9
|
+
export { bitLength };
|
|
10
|
+
}
|
|
11
|
+
export default _default;
|
|
12
|
+
export type Unary = Op.Unary<bigint, bigint>;
|
|
13
|
+
export type Additive<T> = {
|
|
14
|
+
readonly 0: T;
|
|
15
|
+
readonly add: Op.Reduce<T>;
|
|
16
|
+
};
|
|
17
|
+
/** @typedef {Op.Unary<bigint, bigint>} Unary*/
|
|
18
|
+
/** @type {(a: bigint) => (b: bigint) => bigint} */
|
|
19
|
+
declare const addition: (a: bigint) => (b: bigint) => bigint;
|
|
20
|
+
declare const sum: (input: import("../list/module.f.mjs").List<bigint>) => bigint;
|
|
21
|
+
/** @type {(a: bigint) => bigint} */
|
|
22
|
+
declare const abs: (a: bigint) => bigint;
|
|
23
|
+
/** @type {(a: bigint) => compareT.Sign} */
|
|
24
|
+
declare const sign: (a: bigint) => compareT.Sign;
|
|
25
|
+
/** @type {(a: bigint) => string} */
|
|
26
|
+
declare const serialize: (a: bigint) => string;
|
|
27
|
+
/**
|
|
28
|
+
* @template T
|
|
29
|
+
* @typedef {{
|
|
30
|
+
* readonly 0: T
|
|
31
|
+
* readonly add: Op.Reduce<T>
|
|
32
|
+
* }} Additive
|
|
33
|
+
*/
|
|
34
|
+
/** @type {<T>(a: Additive<T>) => (a: T) => (n: bigint) => T} */
|
|
35
|
+
declare const scalar_mul: <T>(a: Additive<T>) => (a: T) => (n: bigint) => T;
|
|
36
|
+
/**
|
|
37
|
+
* Calculates the base-2 logarithm (floor).
|
|
38
|
+
*
|
|
39
|
+
* This function returns the integer part of the logarithm. For example:
|
|
40
|
+
* - `log2(1n)` returns `0n`,
|
|
41
|
+
* - `log2(2n)` returns `1n`,
|
|
42
|
+
* - `log2(15n)` returns `3n`.
|
|
43
|
+
*
|
|
44
|
+
* @param {bigint} v - The input BigInt.
|
|
45
|
+
* @returns {bigint} The base-2 logarithm (floor) of the input BigInt, or `-1n` if the input is less than or equal to 0.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* The function operates in two phases:
|
|
49
|
+
* 1. **Fast Doubling Phase:** Uses exponential steps to quickly narrow down the range
|
|
50
|
+
* of the most significant bit.
|
|
51
|
+
* 2. **Binary Search Phase:** Refines the result by halving the step size and incrementally
|
|
52
|
+
* determining the exact value of the logarithm.
|
|
53
|
+
*/
|
|
54
|
+
declare function log2(v: bigint): bigint;
|
|
55
|
+
/**
|
|
56
|
+
* Calculates the bit length of a given BigInt.
|
|
57
|
+
*
|
|
58
|
+
* The bit length of a number is the number of bits required to represent its absolute value in binary,
|
|
59
|
+
* excluding leading zeros. For example:
|
|
60
|
+
* - `0n` has a bit length of 0 (it has no bits).
|
|
61
|
+
* - `1n` (binary `1`) has a bit length of 1.
|
|
62
|
+
* - `255n` (binary `11111111`) has a bit length of 8.
|
|
63
|
+
* - `-255n` (absolute value `255`, binary `11111111`) also has a bit length of 8.
|
|
64
|
+
*
|
|
65
|
+
* The function handles both positive and negative numbers. For negative inputs, the bit length is calculated
|
|
66
|
+
* based on the absolute value of the number. Zero has a bit length of 0.
|
|
67
|
+
*
|
|
68
|
+
* @param {bigint} v - The input BigInt.
|
|
69
|
+
* @returns {bigint} The bit length of the input BigInt.
|
|
70
|
+
*
|
|
71
|
+
* @remark
|
|
72
|
+
* The function uses the `log2` function to calculate the position of the most significant bit(MSB)
|
|
73
|
+
* and adds `1n` to account for the MSB itself.For negative numbers, the absolute value is used.
|
|
74
|
+
*/
|
|
75
|
+
declare function bitLength(v: bigint): bigint;
|
|
76
|
+
import * as Op from '../function/operator/module.f.mjs';
|
|
77
|
+
import * as compareT from '../function/compare/module.f.mjs';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
function sum(): void;
|
|
3
|
+
let abs: (() => void)[];
|
|
4
|
+
let serialize: (() => void)[];
|
|
5
|
+
let log2: (() => void)[];
|
|
6
|
+
function toString2(): void;
|
|
7
|
+
function minus(): void;
|
|
8
|
+
function not(): void;
|
|
9
|
+
let bitLen: {
|
|
10
|
+
0: () => void;
|
|
11
|
+
m: () => void;
|
|
12
|
+
big: () => void;
|
|
13
|
+
neg: (() => void)[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { find };
|
|
3
|
+
export { value };
|
|
4
|
+
export { isFound };
|
|
5
|
+
}
|
|
6
|
+
export default _default;
|
|
7
|
+
export type FirstLeaf1<T> = readonly [cmpT.Index3, _.Leaf1<T>];
|
|
8
|
+
export type FirstBranch3<T> = readonly [1, _.Branch3<T>];
|
|
9
|
+
export type FirstLeaf2<T> = readonly [cmpT.Index5, _.Leaf2<T>];
|
|
10
|
+
export type FirstBranch5<T> = readonly [1 | 3, _.Branch5<T>];
|
|
11
|
+
export type First<T> = FirstLeaf1<T> | FirstBranch3<T> | FirstLeaf2<T> | FirstBranch5<T>;
|
|
12
|
+
export type PathItem3<T> = readonly [0 | 2, _.Branch3<T>];
|
|
13
|
+
export type PathItem5<T> = readonly [0 | 2 | 4, _.Branch5<T>];
|
|
14
|
+
export type PathItem<T> = PathItem3<T> | PathItem5<T>;
|
|
15
|
+
export type Path<T> = List.List<PathItem<T>>;
|
|
16
|
+
/**
|
|
17
|
+
* <T>
|
|
18
|
+
*/
|
|
19
|
+
export type Result<T> = {
|
|
20
|
+
readonly first: First<T>;
|
|
21
|
+
readonly tail: Path<T>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @template T
|
|
25
|
+
* @typedef {List.List<PathItem<T>>} Path
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* @template T
|
|
29
|
+
* @typedef {{
|
|
30
|
+
* readonly first: First<T>,
|
|
31
|
+
* readonly tail: Path<T>
|
|
32
|
+
* }} Result<T>
|
|
33
|
+
*/
|
|
34
|
+
/** @type {<T>(c: cmpT.Compare<T>) => (node: _.Node<T>) => Result<T>} */
|
|
35
|
+
declare const find: <T>(c: cmpT.Compare<T>) => (node: _.Node<T>) => Result<T>;
|
|
36
|
+
/** @type {<T>(first: First<T>) => T | null} */
|
|
37
|
+
declare const value: <T>(first: First<T>) => T | null;
|
|
38
|
+
/** @type {<T>(first: First<T>) => boolean} */
|
|
39
|
+
declare const isFound: <T>(first: First<T>) => boolean;
|
|
40
|
+
import * as cmpT from '../../function/compare/module.f.mjs';
|
|
41
|
+
import * as _ from '../types/module.f.mjs';
|
|
42
|
+
import * as List from '../../list/module.f.mjs';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export let empty: null;
|
|
3
|
+
export { values };
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
6
|
+
/** @type {<T>(tree: _.Tree<T>) => List.List<T>} */
|
|
7
|
+
declare const values: <T>(tree: _.Tree<T>) => List.List<T>;
|
|
8
|
+
import * as _ from './types/module.f.mjs';
|
|
9
|
+
import * as List from '../list/module.f.mjs';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { nodeRemove };
|
|
3
|
+
export { remove };
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
6
|
+
export type Leaf01<T> = null | _.Leaf1<T>;
|
|
7
|
+
export type RemovePath<T> = {
|
|
8
|
+
readonly first: Leaf01<T>;
|
|
9
|
+
readonly tail: findT.Path<T>;
|
|
10
|
+
};
|
|
11
|
+
export type Branch<T> = _.Branch1<T> | _.Branch3<T> | _.Branch5<T>;
|
|
12
|
+
export type Merge<A, T> = (a: A) => (n: _.Branch3<T>) => _.Branch1<T> | _.Branch3<T>;
|
|
13
|
+
/** @type {<T>(c: cmpT.Compare<T>) => (node: _.Node<T>) => _.Tree<T>} */
|
|
14
|
+
declare const nodeRemove: <T>(c: cmpT.Compare<T>) => (node: _.Node<T>) => _.Tree<T>;
|
|
15
|
+
/** @type {<T>(c: cmpT.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>} */
|
|
16
|
+
declare const remove: <T>(c: cmpT.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>;
|
|
17
|
+
import * as _ from '../types/module.f.mjs';
|
|
18
|
+
import * as findT from '../find/module.f.mjs';
|
|
19
|
+
import * as cmpT from '../../function/compare/module.f.mjs';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { set };
|
|
3
|
+
}
|
|
4
|
+
export default _default;
|
|
5
|
+
export type Branch1To3<T> = _.Branch1<T> | _.Branch3<T>;
|
|
6
|
+
/** @type {<T>(c: cmpT.Compare<T>) => (f: (value: T|null) => T) => (tree: _.Tree<T>) => _.Node<T>} */
|
|
7
|
+
declare const set: <T>(c: cmpT.Compare<T>) => (f: (value: T | null) => T) => (tree: _.Tree<T>) => _.Node<T>;
|
|
8
|
+
import * as _ from '../types/module.f.mjs';
|
|
9
|
+
import * as cmpT from '../../function/compare/module.f.mjs';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { valueTest1 };
|
|
3
|
+
export { valuesTest2 };
|
|
4
|
+
export { findTrue };
|
|
5
|
+
export { find };
|
|
6
|
+
export { test };
|
|
7
|
+
}
|
|
8
|
+
export default _default;
|
|
9
|
+
declare function valueTest1(): void;
|
|
10
|
+
declare function valuesTest2(): void;
|
|
11
|
+
declare function findTrue(): void;
|
|
12
|
+
declare function find(): void;
|
|
13
|
+
declare function test(): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const _default: {};
|
|
2
|
+
export default _default;
|
|
3
|
+
export type Array1<T> = readonly [T];
|
|
4
|
+
export type Array2<T> = readonly [T, T];
|
|
5
|
+
export type Array3<T> = readonly [T, T, T];
|
|
6
|
+
export type Index2 = 0 | 1;
|
|
7
|
+
export type Index3 = 0 | 1 | 2;
|
|
8
|
+
export type Index5 = 0 | 1 | 2 | 3 | 4;
|
|
9
|
+
export type Leaf1<T> = Array1<T>;
|
|
10
|
+
export type Leaf2<T> = Array2<T>;
|
|
11
|
+
export type Branch3<T> = readonly [Node<T>, T, Node<T>];
|
|
12
|
+
export type Branch5<T> = readonly [Node<T>, T, Node<T>, T, Node<T>];
|
|
13
|
+
export type Node<T> = Leaf1<T> | Leaf2<T> | Branch3<T> | Branch5<T>;
|
|
14
|
+
export type Tree<T> = Node<T> | null;
|
|
15
|
+
export type Branch1<T> = readonly [Node<T>];
|
|
16
|
+
export type Branch7<T> = readonly [...Branch5<T>, T, Node<T>];
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
/** @typedef {bigint} ByteSet */
|
|
20
|
+
/** @typedef {number} Byte */
|
|
21
|
+
/** @type {(n: Byte) => (s: ByteSet) => boolean} */
|
|
22
|
+
declare const has: (n: Byte) => (s: ByteSet) => boolean;
|
|
23
|
+
declare const set: import("../function/module.f.mjs").Func<number, (b: ByteSet) => ByteSet>;
|
|
24
|
+
/** @type {(n: Byte) => (s: ByteSet) => ByteSet} */
|
|
25
|
+
declare const unset: (n: Byte) => (s: ByteSet) => ByteSet;
|
|
26
|
+
/** @type {(n: Byte) => ByteSet} */
|
|
27
|
+
declare const one: (n: Byte) => ByteSet;
|
|
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>;
|
|
31
|
+
/** @type {(r: readonly[Byte, Byte]) => ByteSet} */
|
|
32
|
+
declare const range: (r: readonly [Byte, Byte]) => ByteSet;
|
|
33
|
+
/** @type {(n: ByteSet) => ByteSet} */
|
|
34
|
+
declare const complement: (n: ByteSet) => ByteSet;
|
|
35
|
+
/** @type {(n: ByteSet) => (s: string) => RangeMap.RangeMap<SortedSet.SortedSet<string>>} */
|
|
36
|
+
declare const toRangeMap: (n: ByteSet) => (s: string) => RangeMap.RangeMap<SortedSet.SortedSet<string>>;
|
|
37
|
+
import * as RangeMap from '../range_map/module.f.mjs';
|
|
38
|
+
import * as SortedSet from '../sorted_set/module.f.mjs';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let has: (() => void)[];
|
|
3
|
+
function setRange(): void;
|
|
4
|
+
let unset: (() => void)[];
|
|
5
|
+
function universe(): void;
|
|
6
|
+
namespace compliment {
|
|
7
|
+
export function empty(): void;
|
|
8
|
+
export function universe_1(): void;
|
|
9
|
+
export { universe_1 as universe };
|
|
10
|
+
}
|
|
11
|
+
let toRangeMap: (() => void)[];
|
|
12
|
+
}
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
/** @typedef {array.Index3} Index3 */
|
|
15
|
+
/** @typedef {array.Index5} Index5 */
|
|
16
|
+
/**
|
|
17
|
+
* @template T
|
|
18
|
+
* @typedef {array.Array2<T>} Array2
|
|
19
|
+
*/
|
|
20
|
+
/** @typedef {-1|0|1} Sign */
|
|
21
|
+
/**
|
|
22
|
+
* @template T
|
|
23
|
+
* @typedef {(_: T) => Sign} Compare
|
|
24
|
+
*/
|
|
25
|
+
/** @type {<T>(cmp: Compare<T>) => (value: T) => Index3} */
|
|
26
|
+
declare const index3: <T>(cmp: Compare<T>) => (value: T) => Index3;
|
|
27
|
+
/** @type {<T>(cmp: Compare<T>) => (v2: Array2<T>) => Index5} */
|
|
28
|
+
declare const index5: <T>(cmp: Compare<T>) => (v2: Array2<T>) => Index5;
|
|
29
|
+
import * as array from '../../array/module.f.mjs';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { identity };
|
|
3
|
+
export { compose };
|
|
4
|
+
export { flip };
|
|
5
|
+
export { fn };
|
|
6
|
+
}
|
|
7
|
+
export default _default;
|
|
8
|
+
export type Func<I, O> = (_: I) => O;
|
|
9
|
+
export type Fn<I, O> = {
|
|
10
|
+
readonly result: Func<I, O>;
|
|
11
|
+
readonly then: <T>(g: Func<O, T>) => Fn<I, T>;
|
|
12
|
+
};
|
|
13
|
+
/** @type {<T>(value: T) => T} */
|
|
14
|
+
declare const identity: <T>(value: T) => T;
|
|
15
|
+
/**
|
|
16
|
+
* @template I
|
|
17
|
+
* @template O
|
|
18
|
+
* @typedef {(_: I) => O} Func
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* A postfix compose function.
|
|
22
|
+
*
|
|
23
|
+
* @type {<I, X>(g: Func<I, X>) => <O>(f: Func<X, O>) => Func<I, O>}
|
|
24
|
+
*/
|
|
25
|
+
declare const compose: <I, X>(g: Func<I, X>) => <O>(f: Func<X, O>) => Func<I, O>;
|
|
26
|
+
/** @type {<A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C} */
|
|
27
|
+
declare const flip: <A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C;
|
|
28
|
+
/**
|
|
29
|
+
* @template I,O
|
|
30
|
+
* @typedef {{
|
|
31
|
+
* readonly result: Func<I, O>
|
|
32
|
+
* readonly then: <T>(g: Func<O, T>) => Fn<I, T>
|
|
33
|
+
* }} Fn
|
|
34
|
+
*/
|
|
35
|
+
/** @type {<I, O>(f: (i: I) => O) => Fn<I, O>} */
|
|
36
|
+
declare const fn: <I, O>(f: (i: I) => O) => Fn<I, O>;
|