functionalscript 0.1.594 → 0.1.597

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 (167) hide show
  1. package/.github/workflows/npm-publish.yml +2 -1
  2. package/com/cpp/module.f.d.mts +8 -0
  3. package/com/cpp/module.f.mjs +18 -18
  4. package/com/cpp/test.f.d.mts +2 -0
  5. package/com/cpp/testlib.f.d.mts +2 -0
  6. package/com/cs/module.f.d.mts +8 -0
  7. package/com/cs/module.f.mjs +1 -1
  8. package/com/cs/test.f.d.mts +2 -0
  9. package/com/cs/testlib.f.d.mts +2 -0
  10. package/com/rust/module.f.d.mts +28 -0
  11. package/com/rust/module.f.mjs +30 -30
  12. package/com/rust/test.f.d.mts +2 -0
  13. package/com/rust/testlib.f.d.mts +2 -0
  14. package/com/test/build.d.mts +1 -0
  15. package/com/test/build.f.d.mts +26 -0
  16. package/com/test/build.mjs +2 -2
  17. package/com/types/module.f.d.mts +28 -0
  18. package/com/types/module.f.mjs +1 -1
  19. package/com/types/testlib.f.d.mts +44 -0
  20. package/commonjs/build/module.f.d.mts +24 -0
  21. package/commonjs/build/test.f.d.mts +3 -0
  22. package/commonjs/module/function/module.f.d.mts +7 -0
  23. package/commonjs/module/module.f.d.mts +57 -0
  24. package/commonjs/module/module.f.mjs +1 -1
  25. package/commonjs/module.d.mts +7 -0
  26. package/commonjs/module.f.d.mts +4 -0
  27. package/commonjs/package/dependencies/module.f.d.mts +10 -0
  28. package/commonjs/package/dependencies/module.f.mjs +3 -3
  29. package/commonjs/package/dependencies/test.f.d.mts +2 -0
  30. package/commonjs/package/module.f.d.mts +27 -0
  31. package/commonjs/package/module.f.mjs +4 -4
  32. package/commonjs/package/test.f.d.mts +2 -0
  33. package/commonjs/path/module.f.d.mts +67 -0
  34. package/commonjs/path/module.f.mjs +5 -5
  35. package/commonjs/path/test.f.d.mts +25 -0
  36. package/commonjs/path/test.f.mjs +7 -7
  37. package/commonjs/test.d.mts +8 -0
  38. package/commonjs/test.mjs +2 -2
  39. package/dev/index.d.mts +1 -0
  40. package/dev/module.d.mts +26 -0
  41. package/dev/module.f.d.mts +4 -0
  42. package/dev/test/module.f.d.mts +26 -0
  43. package/dev/test.d.mts +3 -0
  44. package/dev/test.f.d.mts +9 -0
  45. package/djs/module.f.d.mts +25 -0
  46. package/djs/module.f.mjs +1 -1
  47. package/djs/parser/module.f.d.mts +40 -0
  48. package/djs/parser/test.f.d.mts +8 -0
  49. package/djs/test.f.d.mts +12 -0
  50. package/djs/tokenizer/module.f.d.mts +17 -0
  51. package/djs/tokenizer/module.f.mjs +1 -1
  52. package/djs/tokenizer/test.f.d.mts +6 -0
  53. package/djs/tokenizer/test.f.mjs +1 -1
  54. package/fsc/module.f.d.mts +12 -0
  55. package/fsc/test.f.d.mts +4 -0
  56. package/fsm/module.f.d.mts +21 -0
  57. package/fsm/test.f.d.mts +5 -0
  58. package/html/module.f.d.mts +20 -0
  59. package/html/module.f.mjs +1 -1
  60. package/html/test.f.d.mts +10 -0
  61. package/index.f.d.mts +83 -0
  62. package/js/tokenizer/module.f.d.mts +150 -0
  63. package/js/tokenizer/test.f.d.mts +8 -0
  64. package/js/tokenizer/test.f.mjs +3 -3
  65. package/json/module.f.d.mts +41 -0
  66. package/json/parser/module.f.d.mts +36 -0
  67. package/json/parser/module.f.mjs +12 -12
  68. package/json/parser/test.f.d.mts +5 -0
  69. package/json/parser/test.f.mjs +2 -2
  70. package/json/serializer/module.f.d.mts +45 -0
  71. package/json/serializer/module.f.mjs +2 -2
  72. package/json/serializer/test.f.d.mts +8 -0
  73. package/json/test.f.d.mts +8 -0
  74. package/json/tokenizer/module.f.d.mts +17 -0
  75. package/json/tokenizer/module.f.mjs +7 -7
  76. package/json/tokenizer/test.f.d.mts +6 -0
  77. package/json/tokenizer/test.f.mjs +3 -3
  78. package/jsr.json +1 -1
  79. package/nodejs/version/main.d.mts +1 -0
  80. package/nodejs/version/module.f.d.mts +18 -0
  81. package/nodejs/version/test.f.d.mts +2 -0
  82. package/package.json +2 -1
  83. package/prime_field/module.f.d.mts +44 -0
  84. package/prime_field/test.f.d.mts +12 -0
  85. package/secp/module.f.d.mts +49 -0
  86. package/secp/module.f.mjs +6 -6
  87. package/secp/test.f.d.mts +4 -0
  88. package/secp/test.f.mjs +5 -5
  89. package/sha2/module.f.d.mts +23 -0
  90. package/sha2/module.f.mjs +1 -1
  91. package/sha2/test.f.d.mts +10 -0
  92. package/sha2/test.f.mjs +0 -1
  93. package/text/ascii/module.f.d.mts +73 -0
  94. package/text/ascii/test.f.d.mts +4 -0
  95. package/text/module.f.d.mts +18 -0
  96. package/text/sgr/module.f.d.mts +14 -0
  97. package/text/test.f.d.mts +2 -0
  98. package/text/utf16/module.f.d.mts +19 -0
  99. package/text/utf16/test.f.d.mts +6 -0
  100. package/text/utf16/test.f.mjs +2 -2
  101. package/text/utf8/module.f.d.mts +15 -0
  102. package/text/utf8/module.f.mjs +2 -2
  103. package/text/utf8/test.f.d.mts +6 -0
  104. package/types/array/module.f.d.mts +41 -0
  105. package/types/array/test.f.d.mts +10 -0
  106. package/types/bigfloat/module.f.d.mts +11 -0
  107. package/types/bigfloat/test.f.d.mts +6 -0
  108. package/types/bigint/module.f.d.mts +77 -0
  109. package/types/bigint/module.f.mjs +5 -5
  110. package/types/bigint/test.f.d.mts +16 -0
  111. package/types/btree/find/module.f.d.mts +42 -0
  112. package/types/btree/find/module.f.mjs +4 -4
  113. package/types/btree/find/test.f.d.mts +2 -0
  114. package/types/btree/find/test.f.mjs +2 -2
  115. package/types/btree/module.f.d.mts +9 -0
  116. package/types/btree/remove/module.f.d.mts +19 -0
  117. package/types/btree/remove/module.f.mjs +12 -12
  118. package/types/btree/remove/test.f.d.mts +7 -0
  119. package/types/btree/remove/test.f.mjs +5 -5
  120. package/types/btree/set/module.f.d.mts +9 -0
  121. package/types/btree/set/module.f.mjs +6 -6
  122. package/types/btree/set/test.f.d.mts +2 -0
  123. package/types/btree/set/test.f.mjs +32 -32
  124. package/types/btree/test.f.d.mts +13 -0
  125. package/types/btree/test.f.mjs +7 -11
  126. package/types/btree/types/module.f.d.mts +16 -0
  127. package/types/byte_set/module.f.d.mts +38 -0
  128. package/types/byte_set/module.f.mjs +2 -2
  129. package/types/byte_set/test.f.d.mts +13 -0
  130. package/types/byte_set/test.f.mjs +3 -3
  131. package/types/function/compare/module.f.d.mts +29 -0
  132. package/types/function/compare/module.f.mjs +4 -4
  133. package/types/function/compare/test.f.d.mts +2 -0
  134. package/types/function/module.f.d.mts +36 -0
  135. package/types/function/operator/module.f.d.mts +75 -0
  136. package/types/function/test.f.d.mts +2 -0
  137. package/types/list/module.f.d.mts +117 -0
  138. package/types/list/test.f.d.mts +38 -0
  139. package/types/map/module.f.d.mts +30 -0
  140. package/types/map/module.f.mjs +4 -4
  141. package/types/map/test.f.d.mts +5 -0
  142. package/types/nibble_set/module.f.d.mts +26 -0
  143. package/types/nibble_set/test.f.d.mts +13 -0
  144. package/types/nullable/module.f.d.mts +14 -0
  145. package/types/nullable/test.f.d.mts +2 -0
  146. package/types/number/module.f.d.mts +13 -0
  147. package/types/number/test.f.d.mts +11 -0
  148. package/types/object/module.f.d.mts +29 -0
  149. package/types/object/test.f.d.mts +5 -0
  150. package/types/range/module.f.d.mts +11 -0
  151. package/types/range/test.f.d.mts +2 -0
  152. package/types/range_map/module.f.d.mts +25 -0
  153. package/types/range_map/module.f.mjs +5 -5
  154. package/types/range_map/test.f.d.mts +6 -0
  155. package/types/range_map/test.f.mjs +2 -2
  156. package/types/result/module.d.mts +7 -0
  157. package/types/result/module.f.d.mts +28 -0
  158. package/types/sorted_list/module.f.d.mts +59 -0
  159. package/types/sorted_list/test.f.d.mts +5 -0
  160. package/types/sorted_list/test.f.mjs +2 -2
  161. package/types/sorted_set/module.f.d.mts +25 -0
  162. package/types/sorted_set/test.f.d.mts +6 -0
  163. package/types/sorted_set/test.f.mjs +1 -1
  164. package/types/string/module.f.d.mts +15 -0
  165. package/types/string/test.f.d.mts +15 -0
  166. package/types/string_set/module.f.d.mts +21 -0
  167. package/types/string_set/test.f.d.mts +5 -0
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.1.594",
3
+ "version": "0.1.597",
4
4
  "description": "FunctionalScript is a functional subset of JavaScript",
5
5
  "main": "index.f.mjs",
6
6
  "scripts": {
7
+ "tscp": "tsc --declaration --emitDeclarationOnly --noEmit false",
7
8
  "tsc": "tsc",
8
9
  "test": "tsc && npm run test-only",
9
10
  "index": "node ./dev/index.mjs",
@@ -0,0 +1,44 @@
1
+ declare namespace _default {
2
+ export { prime_field };
3
+ export let sqrt: (f: PrimeField) => (a: bigint) => bigint | null;
4
+ }
5
+ export default _default;
6
+ export type Reduce = Operator.Reduce<bigint>;
7
+ export type Unary = Operator.Unary<bigint, bigint>;
8
+ export type PrimeField = {
9
+ readonly p: bigint;
10
+ readonly middle: bigint;
11
+ readonly max: bigint;
12
+ readonly neg: Unary;
13
+ readonly sub: Reduce;
14
+ readonly add: Reduce;
15
+ readonly abs: Unary;
16
+ readonly mul: Reduce;
17
+ readonly reciprocal: Unary;
18
+ readonly div: Reduce;
19
+ readonly pow: Reduce;
20
+ readonly pow2: Unary;
21
+ readonly pow3: Unary;
22
+ };
23
+ /** @typedef {Operator.Reduce<bigint>} Reduce */
24
+ /** @typedef {Operator.Unary<bigint, bigint>} Unary*/
25
+ /**
26
+ * @typedef {{
27
+ * readonly p: bigint
28
+ * readonly middle: bigint
29
+ * readonly max: bigint
30
+ * readonly neg: Unary
31
+ * readonly sub: Reduce
32
+ * readonly add: Reduce
33
+ * readonly abs: Unary
34
+ * readonly mul: Reduce
35
+ * readonly reciprocal: Unary
36
+ * readonly div: Reduce
37
+ * readonly pow: Reduce
38
+ * readonly pow2: Unary
39
+ * readonly pow3: Unary
40
+ * }} PrimeField
41
+ */
42
+ /** @type {(p: bigint) => PrimeField} */
43
+ declare const prime_field: (p: bigint) => PrimeField;
44
+ import * as Operator from '../types/function/operator/module.f.mjs';
@@ -0,0 +1,12 @@
1
+ declare namespace _default {
2
+ function prime_field_test(): {
3
+ neg: () => void;
4
+ sub: () => void;
5
+ add: () => void;
6
+ mul: () => void;
7
+ reciprocal: () => void;
8
+ pow: () => void;
9
+ sqrt: () => void;
10
+ };
11
+ }
12
+ export default _default;
@@ -0,0 +1,49 @@
1
+ declare namespace _default {
2
+ export { curve };
3
+ export let eq: (a: Point) => (b: Point) => boolean;
4
+ export let secp256k1: Init;
5
+ export let secp192r1: Init;
6
+ }
7
+ export default _default;
8
+ export type Point2D = readonly [bigint, bigint];
9
+ export type Point = Point2D | null;
10
+ export type Init = {
11
+ readonly p: bigint;
12
+ readonly a: readonly [bigint, bigint];
13
+ readonly g: readonly [bigint, bigint];
14
+ readonly n: bigint;
15
+ };
16
+ export type Curve = {
17
+ readonly pf: Pf.PrimeField;
18
+ readonly nf: Pf.PrimeField;
19
+ readonly y2: (x: bigint) => bigint;
20
+ readonly y: (x: bigint) => bigint | null;
21
+ readonly neg: (a: Point) => Point;
22
+ readonly add: Operator.Reduce<Point>;
23
+ readonly mul: (a: Point) => (n: bigint) => Point;
24
+ };
25
+ /** @typedef {readonly[bigint, bigint]} Point2D */
26
+ /** @typedef {Point2D|null} Point */
27
+ /**
28
+ * @typedef {{
29
+ * readonly p: bigint
30
+ * readonly a: readonly[bigint, bigint]
31
+ * readonly g: readonly[bigint, bigint]
32
+ * readonly n: bigint
33
+ * }} Init
34
+ */
35
+ /**
36
+ * @typedef {{
37
+ * readonly pf: Pf.PrimeField
38
+ * readonly nf: Pf.PrimeField
39
+ * readonly y2: (x: bigint) => bigint
40
+ * readonly y: (x: bigint) => bigint|null
41
+ * readonly neg: (a: Point) => Point
42
+ * readonly add: Operator.Reduce<Point>
43
+ * readonly mul: (a: Point) => (n: bigint) => Point
44
+ * }} Curve
45
+ */
46
+ /** @type {(i: Init) => Curve} */
47
+ declare const curve: (i: Init) => Curve;
48
+ import * as Pf from '../prime_field/module.f.mjs';
49
+ import * as Operator from '../types/function/operator/module.f.mjs';
package/secp/module.f.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import * as op from '../types/function/operator/module.f.mjs'
2
- import pf, * as pfT from '../prime_field/module.f.mjs'
1
+ import * as Operator from '../types/function/operator/module.f.mjs'
2
+ import pf, * as Pf from '../prime_field/module.f.mjs'
3
3
  import bi from '../types/bigint/module.f.mjs'
4
4
  const { scalar_mul } = bi
5
5
  const { prime_field, sqrt } = pf
@@ -19,12 +19,12 @@ const { prime_field, sqrt } = pf
19
19
 
20
20
  /**
21
21
  * @typedef {{
22
- * readonly pf: pfT.PrimeField
23
- * readonly nf: pfT.PrimeField
22
+ * readonly pf: Pf.PrimeField
23
+ * readonly nf: Pf.PrimeField
24
24
  * readonly y2: (x: bigint) => bigint
25
25
  * readonly y: (x: bigint) => bigint|null
26
26
  * readonly neg: (a: Point) => Point
27
- * readonly add: op.Reduce<Point>
27
+ * readonly add: Operator.Reduce<Point>
28
28
  * readonly mul: (a: Point) => (n: bigint) => Point
29
29
  * }} Curve
30
30
  */
@@ -41,7 +41,7 @@ const curve = ({ p, a: [a0, a1], n }) => {
41
41
  // y**2 = a1*x**3 + a0
42
42
  /** @type {(x: bigint) => bigint} */
43
43
  const y2 = x => addA0(add(pow3(x))(mulA1(x)))
44
- /** @type {op.Reduce<Point>} */
44
+ /** @type {Operator.Reduce<Point>} */
45
45
  const addPoint = p => q => {
46
46
  if (p === null) {
47
47
  return q
@@ -0,0 +1,4 @@
1
+ declare namespace _default {
2
+ function test(): void;
3
+ }
4
+ export default _default;
package/secp/test.f.mjs CHANGED
@@ -1,13 +1,13 @@
1
- import mt, * as mT from './module.f.mjs'
2
- const { curve, secp256k1, secp192r1, eq } = mt
1
+ import _, * as T from './module.f.mjs'
2
+ const { curve, secp256k1, secp192r1, eq } = _
3
3
 
4
4
  export default {
5
5
  test: () => {
6
- /** @type {(c: mT.Init) => void} */
6
+ /** @type {(c: T.Init) => void} */
7
7
  const test_curve = c => {
8
8
  const { g } = c
9
9
  const { mul, neg, pf: { abs }, y: yf, nf: { p: n } } = curve(c)
10
- /** @type {(p: mT.Point) => void} */
10
+ /** @type {(p: T.Point) => void} */
11
11
  const point_check = p => {
12
12
  if (p === null) { throw 'null' }
13
13
  const [x, y] = p
@@ -17,7 +17,7 @@ export default {
17
17
  }
18
18
  point_check(g)
19
19
  point_check(neg(g))
20
- /** @type {(p: mT.Point) => void} */
20
+ /** @type {(p: T.Point) => void} */
21
21
  const test_mul = p => {
22
22
  if (mul(p)(0n) !== null) { throw 'O' }
23
23
  if (mul(p)(1n) !== p) { throw 'p' }
@@ -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';
package/sha2/module.f.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import array, * as arrayT from '../types/array/module.f.mjs'
1
+ import * as arrayT from '../types/array/module.f.mjs'
2
2
 
3
3
  /**
4
4
  * @typedef {{
@@ -0,0 +1,10 @@
1
+ declare namespace _default {
2
+ export namespace empty {
3
+ function sha256(): void;
4
+ function sha224(): void;
5
+ }
6
+ export let sha224compress: (() => void)[];
7
+ let sha256_1: (() => void)[];
8
+ export { sha256_1 as sha256 };
9
+ }
10
+ export default _default;
package/sha2/test.f.mjs CHANGED
@@ -2,7 +2,6 @@ import _ from './module.f.mjs'
2
2
  import json, * as jsonT from '../json/module.f.mjs'
3
3
  import o from '../types/object/module.f.mjs'
4
4
  const { sort } = o
5
- import list from '../types/list/module.f.mjs'
6
5
 
7
6
  /** @type {(a: number) => number} */
8
7
  const toU32 = x => (x + 0x1_0000_0000) % 0x1_0000_0000
@@ -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,4 @@
1
+ declare namespace _default {
2
+ function range(): void;
3
+ }
4
+ export default _default;
@@ -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,2 @@
1
+ declare function _default(): void;
2
+ export default _default;
@@ -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,6 @@
1
+ declare namespace _default {
2
+ let toCodePointList: (() => void)[];
3
+ let fromCodePointList: (() => void)[];
4
+ let string: (() => void)[];
5
+ }
6
+ export default _default;
@@ -1,10 +1,10 @@
1
1
  import encoding from './module.f.mjs'
2
- import json, * as jsonT from '../../json/module.f.mjs'
2
+ import json, * as Json from '../../json/module.f.mjs'
3
3
  import o from '../../types/object/module.f.mjs'
4
4
  const { sort } = o
5
5
  import list from '../../types/list/module.f.mjs'
6
6
 
7
- /** @type {(a: readonly jsonT.Unknown[]) => string} */
7
+ /** @type {(a: readonly Json.Unknown[]) => string} */
8
8
  const stringify = a => json.stringify(sort)(a)
9
9
 
10
10
  export default {
@@ -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 = Array.Array1<number> | Array.Array2<number> | Array.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 Array from '../../types/array/module.f.mjs';
15
+ import * as List from '../../types/list/module.f.mjs';
@@ -1,11 +1,11 @@
1
1
  import list, * as List from '../../types/list/module.f.mjs'
2
2
  import * as operator from '../../types/function/operator/module.f.mjs'
3
- import * as arrayT from '../../types/array/module.f.mjs'
3
+ import * as Array from '../../types/array/module.f.mjs'
4
4
  const { flatMap, flat, stateScan } = list
5
5
 
6
6
  /** @typedef {u8|null} ByteOrEof */
7
7
 
8
- /** @typedef {arrayT.Array1<number>|arrayT.Array2<number>|arrayT.Array3<number>} Utf8NonEmptyState */
8
+ /** @typedef {Array.Array1<number>|Array.Array2<number>|Array.Array3<number>} Utf8NonEmptyState */
9
9
 
10
10
  /** @typedef {null|Utf8NonEmptyState} Utf8State */
11
11
 
@@ -0,0 +1,6 @@
1
+ declare namespace _default {
2
+ let toCodePoint: (() => void)[];
3
+ let fromCodePointList: (() => void)[];
4
+ let toFrom: (() => void)[];
5
+ }
6
+ export default _default;
@@ -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,6 @@
1
+ declare namespace _default {
2
+ let decToBin: (() => void)[];
3
+ let roundingPositive: (() => void)[];
4
+ let roundingNegative: (() => void)[];
5
+ }
6
+ export default _default;
@@ -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 = Operator.Unary<bigint, bigint>;
13
+ export type Additive<T> = {
14
+ readonly 0: T;
15
+ readonly add: Operator.Reduce<T>;
16
+ };
17
+ /** @typedef {Operator.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) => Compare.Sign} */
24
+ declare const sign: (a: bigint) => Compare.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: Operator.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 Operator from '../function/operator/module.f.mjs';
77
+ import * as Compare from '../function/compare/module.f.mjs';
@@ -1,10 +1,10 @@
1
- import compare, * as compareT from '../function/compare/module.f.mjs'
2
- import op, * as Op from '../function/operator/module.f.mjs'
1
+ import compare, * as Compare from '../function/compare/module.f.mjs'
2
+ import * as Operator from '../function/operator/module.f.mjs'
3
3
  const { unsafeCmp } = compare
4
4
  import list from '../list/module.f.mjs'
5
5
  const { reduce } = list
6
6
 
7
- /** @typedef {Op.Unary<bigint, bigint>} Unary*/
7
+ /** @typedef {Operator.Unary<bigint, bigint>} Unary*/
8
8
 
9
9
  /** @type {(a: bigint) => (b: bigint) => bigint} */
10
10
  const addition = a => b => a + b
@@ -14,7 +14,7 @@ const sum = reduce(addition)(0n)
14
14
  /** @type {(a: bigint) => bigint} */
15
15
  const abs = a => a >= 0 ? a : -a
16
16
 
17
- /** @type {(a: bigint) => compareT.Sign} */
17
+ /** @type {(a: bigint) => Compare.Sign} */
18
18
  const sign = a => unsafeCmp(a)(0n)
19
19
 
20
20
  /** @type {(a: bigint) => string} */
@@ -24,7 +24,7 @@ const serialize = a => `${a}n`
24
24
  * @template T
25
25
  * @typedef {{
26
26
  * readonly 0: T
27
- * readonly add: Op.Reduce<T>
27
+ * readonly add: Operator.Reduce<T>
28
28
  * }} Additive
29
29
  */
30
30
 
@@ -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;