functionalscript 0.3.6 → 0.3.8

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 (124) hide show
  1. package/com/cpp/module.f.js +0 -1
  2. package/com/cs/module.f.js +5 -6
  3. package/com/rust/module.f.d.ts +3 -3
  4. package/com/rust/module.f.js +24 -29
  5. package/com/test/build.f.js +2 -2
  6. package/com/types/module.f.d.ts +1 -1
  7. package/com/types/module.f.js +1 -2
  8. package/com/types/testlib.f.js +0 -1
  9. package/commonjs/build/module.f.d.ts +2 -2
  10. package/commonjs/build/module.f.js +3 -6
  11. package/commonjs/build/test.f.js +0 -4
  12. package/commonjs/module/function/module.f.d.ts +1 -1
  13. package/commonjs/module/function/module.f.js +1 -1
  14. package/commonjs/module/module.f.d.ts +1 -1
  15. package/commonjs/module/module.f.js +2 -3
  16. package/commonjs/path/module.f.d.ts +5 -5
  17. package/commonjs/path/module.f.js +6 -8
  18. package/commonjs/path/test.f.js +1 -2
  19. package/crypto/prime_field/module.f.d.ts +2 -2
  20. package/crypto/prime_field/module.f.js +3 -4
  21. package/crypto/secp/module.f.d.ts +2 -2
  22. package/crypto/secp/module.f.js +4 -5
  23. package/crypto/sha2/module.f.d.ts +75 -12
  24. package/crypto/sha2/module.f.js +246 -139
  25. package/crypto/sha2/test.f.d.ts +22 -3
  26. package/crypto/sha2/test.f.js +120 -67
  27. package/dev/test/module.f.d.ts +1 -1
  28. package/dev/test/module.f.js +4 -5
  29. package/dev/test.f.js +0 -4
  30. package/djs/module.f.d.ts +1 -1
  31. package/djs/module.f.js +0 -1
  32. package/djs/parser/module.f.d.ts +1 -1
  33. package/djs/parser/module.f.js +0 -2
  34. package/djs/serializer/module.f.d.ts +2 -2
  35. package/djs/serializer/module.f.js +0 -2
  36. package/djs/tokenizer/module.f.js +0 -1
  37. package/fsc/test.f.js +0 -1
  38. package/html/module.f.d.ts +1 -1
  39. package/html/module.f.js +15 -11
  40. package/html/test.f.js +7 -7
  41. package/js/tokenizer/module.f.d.ts +2 -2
  42. package/js/tokenizer/module.f.js +1 -2
  43. package/json/parser/module.f.d.ts +2 -2
  44. package/json/parser/module.f.js +0 -3
  45. package/json/serializer/module.f.js +0 -2
  46. package/json/tokenizer/module.f.js +0 -1
  47. package/nanvm-lib/tests/test.f.d.ts +28 -0
  48. package/nanvm-lib/tests/test.f.js +45 -0
  49. package/package.json +1 -1
  50. package/text/ascii/module.f.d.ts +1 -1
  51. package/text/ascii/module.f.js +2 -3
  52. package/text/ascii/test.f.js +2 -4
  53. package/text/module.f.d.ts +18 -3
  54. package/text/module.f.js +22 -6
  55. package/text/sgr/module.f.js +1 -1
  56. package/text/test.f.d.ts +4 -1
  57. package/text/test.f.js +24 -16
  58. package/text/utf16/module.f.d.ts +5 -6
  59. package/text/utf16/module.f.js +9 -10
  60. package/text/utf16/test.f.js +29 -30
  61. package/text/utf8/module.f.d.ts +8 -5
  62. package/text/utf8/module.f.js +3 -5
  63. package/text/utf8/test.f.js +34 -35
  64. package/types/array/module.f.d.ts +12 -9
  65. package/types/array/module.f.js +10 -11
  66. package/types/array/test.f.d.ts +1 -0
  67. package/types/array/test.f.js +18 -17
  68. package/types/bigfloat/module.f.d.ts +1 -1
  69. package/types/bigfloat/module.f.js +7 -8
  70. package/types/bigfloat/test.f.js +1 -2
  71. package/types/bigint/module.f.d.ts +20 -11
  72. package/types/bigint/module.f.js +19 -20
  73. package/types/bigint/test.f.d.ts +1 -0
  74. package/types/bigint/test.f.js +7 -2
  75. package/types/bit_vec/module.f.d.ts +103 -83
  76. package/types/bit_vec/module.f.js +68 -110
  77. package/types/bit_vec/test.f.d.ts +20 -8
  78. package/types/bit_vec/test.f.js +110 -117
  79. package/types/btree/find/test.f.js +3 -4
  80. package/types/btree/module.f.d.ts +3 -3
  81. package/types/btree/module.f.js +2 -5
  82. package/types/btree/remove/test.f.js +2 -3
  83. package/types/btree/set/test.f.js +3 -6
  84. package/types/btree/test.f.js +0 -1
  85. package/types/btree/types/module.f.d.ts +3 -3
  86. package/types/byte_set/module.f.d.ts +2 -2
  87. package/types/byte_set/module.f.js +0 -2
  88. package/types/function/compare/module.f.d.ts +1 -1
  89. package/types/function/compare/module.f.js +0 -1
  90. package/types/function/compare/test.f.js +1 -2
  91. package/types/function/module.f.d.ts +1 -1
  92. package/types/function/module.f.js +1 -1
  93. package/types/function/operator/module.f.d.ts +2 -3
  94. package/types/function/operator/module.f.js +5 -5
  95. package/types/function/test.f.js +1 -2
  96. package/types/list/module.f.d.ts +1 -1
  97. package/types/list/module.f.js +9 -9
  98. package/types/list/test.f.js +2 -4
  99. package/types/map/module.f.d.ts +6 -6
  100. package/types/map/module.f.js +6 -15
  101. package/types/map/test.f.js +1 -2
  102. package/types/monoid/module.f.d.ts +73 -0
  103. package/types/monoid/module.f.js +42 -0
  104. package/types/monoid/test.f.d.ts +5 -0
  105. package/types/monoid/test.f.js +27 -0
  106. package/types/nibble_set/module.f.d.ts +2 -3
  107. package/types/nibble_set/test.f.js +1 -2
  108. package/types/number/test.f.js +1 -2
  109. package/types/object/module.f.d.ts +5 -5
  110. package/types/object/module.f.js +2 -4
  111. package/types/range_map/module.f.d.ts +4 -4
  112. package/types/range_map/module.f.js +3 -9
  113. package/types/result/module.f.d.ts +2 -3
  114. package/types/sorted_list/module.f.d.ts +6 -6
  115. package/types/sorted_list/module.f.js +2 -6
  116. package/types/sorted_list/test.f.js +4 -9
  117. package/types/sorted_set/module.f.d.ts +1 -1
  118. package/types/sorted_set/module.f.js +2 -5
  119. package/types/sorted_set/test.f.js +4 -9
  120. package/types/string/module.f.d.ts +3 -3
  121. package/types/string/module.f.js +1 -2
  122. package/types/string/test.f.js +2 -4
  123. package/types/string_set/module.f.d.ts +1 -1
  124. package/types/string_set/module.f.js +5 -11
@@ -1,55 +1,54 @@
1
- import * as encoding from "./module.f.js";
1
+ import { toCodePointList, fromCodePointList, stringToList, listToString } from "./module.f.js";
2
2
  import * as json from "../../json/module.f.js";
3
- import * as o from "../../types/object/module.f.js";
4
- const { sort } = o;
5
- import * as list from "../../types/list/module.f.js";
6
- const stringify = a => json.stringify(sort)(a);
3
+ import { sort } from "../../types/object/module.f.js";
4
+ import { toArray } from "../../types/list/module.f.js";
5
+ const stringify = (a) => json.stringify(sort)(a);
7
6
  export default {
8
7
  toCodePointList: [
9
8
  () => {
10
- const result = stringify(list.toArray(encoding.toCodePointList([-1, 65536])));
9
+ const result = stringify(toArray(toCodePointList([-1, 65536])));
11
10
  if (result !== '[4294967295,4294967295]') {
12
11
  throw result;
13
12
  }
14
13
  },
15
14
  () => {
16
- const result = stringify(list.toArray(encoding.toCodePointList([0, 36, 8364, 55295, 57344, 65535])));
15
+ const result = stringify(toArray(toCodePointList([0, 36, 8364, 55295, 57344, 65535])));
17
16
  if (result !== '[0,36,8364,55295,57344,65535]') {
18
17
  throw result;
19
18
  }
20
19
  },
21
20
  () => {
22
- const result = stringify(list.toArray(encoding.toCodePointList([56320, 57343])));
21
+ const result = stringify(toArray(toCodePointList([56320, 57343])));
23
22
  if (result !== '[-2147427328,-2147426305]') {
24
23
  throw result;
25
24
  }
26
25
  },
27
26
  () => {
28
- const result = stringify(list.toArray(encoding.toCodePointList([55296, 56320, 55297, 56375, 55378, 57186, 56319, 57343])));
27
+ const result = stringify(toArray(toCodePointList([55296, 56320, 55297, 56375, 55378, 57186, 56319, 57343])));
29
28
  if (result !== '[65536,66615,150370,1114111]') {
30
29
  throw result;
31
30
  }
32
31
  },
33
32
  () => {
34
- const result = stringify(list.toArray(encoding.toCodePointList([55296, 55296])));
33
+ const result = stringify(toArray(toCodePointList([55296, 55296])));
35
34
  if (result !== '[-2147428352,-2147428352]') {
36
35
  throw result;
37
36
  }
38
37
  },
39
38
  () => {
40
- const result = stringify(list.toArray(encoding.toCodePointList([55296, 0])));
39
+ const result = stringify(toArray(toCodePointList([55296, 0])));
41
40
  if (result !== '[-2147428352,0]') {
42
41
  throw result;
43
42
  }
44
43
  },
45
44
  () => {
46
- const result = stringify(list.toArray(encoding.toCodePointList([56320])));
45
+ const result = stringify(toArray(toCodePointList([56320])));
47
46
  if (result !== '[-2147427328]') {
48
47
  throw result;
49
48
  }
50
49
  },
51
50
  () => {
52
- const result = stringify(list.toArray(encoding.toCodePointList([56320, 0])));
51
+ const result = stringify(toArray(toCodePointList([56320, 0])));
53
52
  if (result !== '[-2147427328,0]') {
54
53
  throw result;
55
54
  }
@@ -57,67 +56,67 @@ export default {
57
56
  ],
58
57
  fromCodePointList: [
59
58
  () => {
60
- const result = stringify(list.toArray(encoding.fromCodePointList([0])));
59
+ const result = stringify(toArray(fromCodePointList([0])));
61
60
  if (result !== '[0]') {
62
61
  throw result;
63
62
  }
64
63
  },
65
64
  () => {
66
- const result = stringify(list.toArray(encoding.fromCodePointList([0x24])));
65
+ const result = stringify(toArray(fromCodePointList([0x24])));
67
66
  if (result !== '[36]') {
68
67
  throw result;
69
68
  }
70
69
  },
71
70
  () => {
72
- const result = stringify(list.toArray(encoding.fromCodePointList([0x20AC])));
71
+ const result = stringify(toArray(fromCodePointList([0x20AC])));
73
72
  if (result !== '[8364]') {
74
73
  throw result;
75
74
  }
76
75
  },
77
76
  () => {
78
- const result = stringify(list.toArray(encoding.fromCodePointList([0xd7ff])));
77
+ const result = stringify(toArray(fromCodePointList([0xd7ff])));
79
78
  if (result !== '[55295]') {
80
79
  throw result;
81
80
  }
82
81
  },
83
82
  () => {
84
- const result = stringify(list.toArray(encoding.fromCodePointList([0xe000])));
83
+ const result = stringify(toArray(fromCodePointList([0xe000])));
85
84
  if (result !== '[57344]') {
86
85
  throw result;
87
86
  }
88
87
  },
89
88
  () => {
90
- const result = stringify(list.toArray(encoding.fromCodePointList([0xffff])));
89
+ const result = stringify(toArray(fromCodePointList([0xffff])));
91
90
  if (result !== '[65535]') {
92
91
  throw result;
93
92
  }
94
93
  },
95
94
  () => {
96
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10000])));
95
+ const result = stringify(toArray(fromCodePointList([0x10000])));
97
96
  if (result !== '[55296,56320]') {
98
97
  throw result;
99
98
  }
100
99
  },
101
100
  () => {
102
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10437])));
101
+ const result = stringify(toArray(fromCodePointList([0x10437])));
103
102
  if (result !== '[55297,56375]') {
104
103
  throw result;
105
104
  }
106
105
  },
107
106
  () => {
108
- const result = stringify(list.toArray(encoding.fromCodePointList([0x24B62])));
107
+ const result = stringify(toArray(fromCodePointList([0x24B62])));
109
108
  if (result !== '[55378,57186]') {
110
109
  throw result;
111
110
  }
112
111
  },
113
112
  () => {
114
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10ffff])));
113
+ const result = stringify(toArray(fromCodePointList([0x10ffff])));
115
114
  if (result !== '[56319,57343]') {
116
115
  throw result;
117
116
  }
118
117
  },
119
118
  () => {
120
- const result = stringify(list.toArray(encoding.fromCodePointList([-1, 0xd800, 0xdfff, 0x110000])));
119
+ const result = stringify(toArray(fromCodePointList([-1, 0xd800, 0xdfff, 0x110000])));
121
120
  if (result !== '[65535,55296,57343,0]') {
122
121
  throw result;
123
122
  }
@@ -125,17 +124,17 @@ export default {
125
124
  ],
126
125
  string: [
127
126
  () => {
128
- const utf16List = encoding.stringToList("Hello world!😂🚜🚲");
129
- const result = encoding.listToString(utf16List);
127
+ const utf16List = stringToList("Hello world!😂🚜🚲");
128
+ const result = listToString(utf16List);
130
129
  if (result !== "Hello world!😂🚜🚲") {
131
130
  throw result;
132
131
  }
133
132
  },
134
133
  () => {
135
- const a = encoding.stringToList("Hello world!😂🚜🚲");
136
- const b = encoding.toCodePointList(a);
137
- const c = encoding.fromCodePointList(b);
138
- const result = encoding.listToString(c);
134
+ const a = stringToList("Hello world!😂🚜🚲");
135
+ const b = toCodePointList(a);
136
+ const c = fromCodePointList(b);
137
+ const result = listToString(c);
139
138
  if (result !== "Hello world!😂🚜🚲") {
140
139
  throw result;
141
140
  }
@@ -1,6 +1,9 @@
1
1
  import { type List, type Thunk } from '../../types/list/module.f.ts';
2
- type u8 = number;
3
- type i32 = number;
4
- export declare const fromCodePointList: (input: List<number>) => Thunk<number>;
5
- export declare const toCodePointList: (input: List<u8>) => List<i32>;
6
- export {};
2
+ import type { Array1, Array2, Array3 } from '../../types/array/module.f.ts';
3
+ export type ByteOrEof = U8 | null;
4
+ export type Utf8NonEmptyState = Array1<number> | Array2<number> | Array3<number>;
5
+ export type Utf8State = null | Utf8NonEmptyState;
6
+ export type U8 = number;
7
+ export type I32 = number;
8
+ export declare const fromCodePointList: (input: List<number>) => Thunk<U8>;
9
+ export declare const toCodePointList: (input: List<U8>) => List<I32>;
@@ -1,8 +1,6 @@
1
1
  import { flatMap, flat, stateScan } from "../../types/list/module.f.js";
2
- import * as operator from "../../types/function/operator/module.f.js";
3
- import * as Array from "../../types/array/module.f.js";
4
2
  const errorMask = 0b1000_0000_0000_0000_0000_0000_0000_0000;
5
- const codePointToUtf8 = input => {
3
+ const codePointToUtf8 = (input) => {
6
4
  if (input >= 0x0000 && input <= 0x007f) {
7
5
  return [input & 0b01111_1111];
8
6
  }
@@ -32,7 +30,7 @@ const codePointToUtf8 = input => {
32
30
  return [errorMask];
33
31
  };
34
32
  export const fromCodePointList = flatMap(codePointToUtf8);
35
- const utf8StateToError = state => {
33
+ const utf8StateToError = (state) => {
36
34
  let x;
37
35
  switch (state.length) {
38
36
  case 1: {
@@ -106,7 +104,7 @@ const utf8ByteToCodePointOp = state => byte => {
106
104
  }
107
105
  return [[error, byte | errorMask], null];
108
106
  };
109
- const utf8EofToCodePointOp = state => [state === null ? null : [utf8StateToError(state)], null];
107
+ const utf8EofToCodePointOp = (state) => [state === null ? null : [utf8StateToError(state)], null];
110
108
  const utf8ByteOrEofToCodePointOp = state => input => input === null ? utf8EofToCodePointOp(state) : utf8ByteToCodePointOp(state)(input);
111
109
  const eofList = [null];
112
110
  export const toCodePointList = input => flat(stateScan(utf8ByteOrEofToCodePointOp)(null)(flat([input, eofList])));
@@ -1,67 +1,66 @@
1
- import * as encoding from "./module.f.js";
1
+ import { toCodePointList, fromCodePointList } from "./module.f.js";
2
2
  import * as json from "../../json/module.f.js";
3
- import * as o from "../../types/object/module.f.js";
4
- const { sort } = o;
5
- import * as list from "../../types/list/module.f.js";
3
+ import { sort } from "../../types/object/module.f.js";
4
+ import { toArray } from "../../types/list/module.f.js";
6
5
  const stringify = json.stringify(sort);
7
6
  export default {
8
7
  toCodePoint: [
9
8
  () => {
10
- const result = stringify(list.toArray(encoding.toCodePointList([-1, 256])));
9
+ const result = stringify(toArray(toCodePointList([-1, 256])));
11
10
  if (result !== '[2147483648,2147483648]') {
12
11
  throw result;
13
12
  }
14
13
  },
15
14
  () => {
16
- const result = stringify(list.toArray(encoding.toCodePointList([128, 193, 245, 255])));
15
+ const result = stringify(toArray(toCodePointList([128, 193, 245, 255])));
17
16
  if (result !== '[-2147483520,-2147483455,-2147483403,-2147483393]') {
18
17
  throw result;
19
18
  }
20
19
  },
21
20
  () => {
22
- const result = stringify(list.toArray(encoding.toCodePointList([0, 1, 127])));
21
+ const result = stringify(toArray(toCodePointList([0, 1, 127])));
23
22
  if (result !== '[0,1,127]') {
24
23
  throw result;
25
24
  }
26
25
  },
27
26
  () => {
28
- const result = stringify(list.toArray(encoding.toCodePointList([194, 128, 194, 169, 223, 191])));
27
+ const result = stringify(toArray(toCodePointList([194, 128, 194, 169, 223, 191])));
29
28
  if (result !== '[128,169,2047]') {
30
29
  throw result;
31
30
  }
32
31
  },
33
32
  () => {
34
- const result = stringify(list.toArray(encoding.toCodePointList([194, 194, 127, 194, 192, 194])));
33
+ const result = stringify(toArray(toCodePointList([194, 194, 127, 194, 192, 194])));
35
34
  if (result !== '[-2147483454,-2147483454,127,-2147483454,-2147483456,-2147483454]') {
36
35
  throw result;
37
36
  }
38
37
  },
39
38
  () => {
40
- const result = stringify(list.toArray(encoding.toCodePointList([224, 160, 128, 224, 160, 129, 239, 191, 191])));
39
+ const result = stringify(toArray(toCodePointList([224, 160, 128, 224, 160, 129, 239, 191, 191])));
41
40
  if (result !== '[2048,2049,65535]') {
42
41
  throw result;
43
42
  }
44
43
  },
45
44
  () => {
46
- const result = stringify(list.toArray(encoding.toCodePointList([224, 224, 160, 127, 239, 191])));
45
+ const result = stringify(toArray(toCodePointList([224, 224, 160, 127, 239, 191])));
47
46
  if (result !== '[-2147483424,-2147482592,127,-2147481601]') {
48
47
  throw result;
49
48
  }
50
49
  },
51
50
  () => {
52
- const result = stringify(list.toArray(encoding.toCodePointList([240, 144, 128, 128, 240, 144, 128, 129, 244, 143, 191, 191])));
51
+ const result = stringify(toArray(toCodePointList([240, 144, 128, 128, 240, 144, 128, 129, 244, 143, 191, 191])));
53
52
  if (result !== '[65536,65537,1114111]') {
54
53
  throw result;
55
54
  }
56
55
  },
57
56
  () => {
58
- const result = stringify(list.toArray(encoding.toCodePointList([240, 240, 160, 127, 244, 191])));
57
+ const result = stringify(toArray(toCodePointList([240, 240, 160, 127, 244, 191])));
59
58
  if (result !== '[-2147483408,-2147483104,127,-2147482817]') {
60
59
  throw result;
61
60
  }
62
61
  },
63
62
  () => {
64
- const result = stringify(list.toArray(encoding.toCodePointList([240, 160, 160, 244, 160, 160])));
63
+ const result = stringify(toArray(toCodePointList([240, 160, 160, 244, 160, 160])));
65
64
  if (result !== '[-2147448800,-2147432416]') {
66
65
  throw result;
67
66
  }
@@ -69,67 +68,67 @@ export default {
69
68
  ],
70
69
  fromCodePointList: [
71
70
  () => {
72
- const result = stringify(list.toArray(encoding.fromCodePointList([0, 1, 0x7F])));
71
+ const result = stringify(toArray(fromCodePointList([0, 1, 0x7F])));
73
72
  if (result !== '[0,1,127]') {
74
73
  throw result;
75
74
  }
76
75
  },
77
76
  () => {
78
- const result = stringify(list.toArray(encoding.fromCodePointList([0x80])));
77
+ const result = stringify(toArray(fromCodePointList([0x80])));
79
78
  if (result !== '[194,128]') {
80
79
  throw result;
81
80
  }
82
81
  },
83
82
  () => {
84
- const result = stringify(list.toArray(encoding.fromCodePointList([0xa9])));
83
+ const result = stringify(toArray(fromCodePointList([0xa9])));
85
84
  if (result !== '[194,169]') {
86
85
  throw result;
87
86
  }
88
87
  },
89
88
  () => {
90
- const result = stringify(list.toArray(encoding.fromCodePointList([0x7ff])));
89
+ const result = stringify(toArray(fromCodePointList([0x7ff])));
91
90
  if (result !== '[223,191]') {
92
91
  throw result;
93
92
  }
94
93
  },
95
94
  () => {
96
- const result = stringify(list.toArray(encoding.fromCodePointList([0x800])));
95
+ const result = stringify(toArray(fromCodePointList([0x800])));
97
96
  if (result !== '[224,160,128]') {
98
97
  throw result;
99
98
  }
100
99
  },
101
100
  () => {
102
- const result = stringify(list.toArray(encoding.fromCodePointList([0x801])));
101
+ const result = stringify(toArray(fromCodePointList([0x801])));
103
102
  if (result !== '[224,160,129]') {
104
103
  throw result;
105
104
  }
106
105
  },
107
106
  () => {
108
- const result = stringify(list.toArray(encoding.fromCodePointList([0xffff])));
107
+ const result = stringify(toArray(fromCodePointList([0xffff])));
109
108
  if (result !== '[239,191,191]') {
110
109
  throw result;
111
110
  }
112
111
  },
113
112
  () => {
114
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10000])));
113
+ const result = stringify(toArray(fromCodePointList([0x10000])));
115
114
  if (result !== '[240,144,128,128]') {
116
115
  throw result;
117
116
  }
118
117
  },
119
118
  () => {
120
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10001])));
119
+ const result = stringify(toArray(fromCodePointList([0x10001])));
121
120
  if (result !== '[240,144,128,129]') {
122
121
  throw result;
123
122
  }
124
123
  },
125
124
  () => {
126
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10FFFF])));
125
+ const result = stringify(toArray(fromCodePointList([0x10FFFF])));
127
126
  if (result !== '[244,143,191,191]') {
128
127
  throw result;
129
128
  }
130
129
  },
131
130
  () => {
132
- const result = stringify(list.toArray(encoding.fromCodePointList([0x110000, 2147483648])));
131
+ const result = stringify(toArray(fromCodePointList([0x110000, 2147483648])));
133
132
  if (result !== '[2147483648,2147483648]') {
134
133
  throw result;
135
134
  }
@@ -137,36 +136,36 @@ export default {
137
136
  ],
138
137
  toFrom: [
139
138
  () => {
140
- const codePointList = encoding.toCodePointList([128, 193, 245, 255]);
141
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)));
139
+ const codePointList = toCodePointList([128, 193, 245, 255]);
140
+ const result = stringify(toArray(fromCodePointList(codePointList)));
142
141
  if (result !== '[128,193,245,255]') {
143
142
  throw result;
144
143
  }
145
144
  },
146
145
  () => {
147
- const codePointList = encoding.toCodePointList([194, 194, 127, 194, 192, 194]);
148
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)));
146
+ const codePointList = toCodePointList([194, 194, 127, 194, 192, 194]);
147
+ const result = stringify(toArray(fromCodePointList(codePointList)));
149
148
  if (result !== '[194,194,127,194,192,194]') {
150
149
  throw result;
151
150
  }
152
151
  },
153
152
  () => {
154
- const codePointList = encoding.toCodePointList([224, 224, 160, 127, 239, 191]);
155
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)));
153
+ const codePointList = toCodePointList([224, 224, 160, 127, 239, 191]);
154
+ const result = stringify(toArray(fromCodePointList(codePointList)));
156
155
  if (result !== '[224,224,160,127,239,191]') {
157
156
  throw result;
158
157
  }
159
158
  },
160
159
  () => {
161
- const codePointList = encoding.toCodePointList([240, 240, 160, 127, 244, 191]);
162
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)));
160
+ const codePointList = toCodePointList([240, 240, 160, 127, 244, 191]);
161
+ const result = stringify(toArray(fromCodePointList(codePointList)));
163
162
  if (result !== '[240,240,160,127,244,191]') {
164
163
  throw result;
165
164
  }
166
165
  },
167
166
  () => {
168
- const codePointList = encoding.toCodePointList([240, 160, 160, 244, 160, 160]);
169
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)));
167
+ const codePointList = toCodePointList([240, 160, 160, 244, 160, 160]);
168
+ const result = stringify(toArray(fromCodePointList(codePointList)));
170
169
  if (result !== '[240,160,160,244,160,160]') {
171
170
  throw result;
172
171
  }
@@ -1,21 +1,24 @@
1
1
  export type Array1<T> = readonly [T];
2
- type Index1 = 0;
2
+ export type Index1 = 0;
3
3
  export type Array2<T> = readonly [T, T];
4
- type Index2 = 0 | 1;
4
+ export type Tuple2<T0, T1> = readonly [T0, T1];
5
+ export type Index2 = 0 | 1;
5
6
  export type Array3<T> = readonly [T, T, T];
7
+ export type Tuple3<T0, T1, T2> = readonly [T0, T1, T2];
6
8
  export type Index3 = 0 | 1 | 2;
7
9
  export type Array4<T> = readonly [T, T, T, T];
8
- type Index4 = 0 | 1 | 2 | 3;
10
+ export type Index4 = 0 | 1 | 2 | 3;
9
11
  export type Array5<T> = readonly [T, T, T, T, T];
10
12
  export type Array8<T> = readonly [T, T, T, T, T, T, T, T];
11
13
  export type Array16<T> = readonly [T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T];
14
+ export type Index16 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
15
+ export type Array1_5<T> = Array1<T> | Array2<T> | Array3<T> | Array4<T> | Array5<T>;
12
16
  export type Index5 = 0 | 1 | 2 | 3 | 4;
13
17
  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;
14
- export declare const at: (index: number) => <T>(a: readonly T[]) => T | null;
18
+ export declare const at: (i: number) => <T>(a: readonly T[]) => T | null;
15
19
  export declare const first: <T>(_: readonly T[]) => T | null;
16
- export declare const last: <T>(_: readonly T[]) => T | null;
17
- export declare const tail: <T>(_: readonly T[]) => readonly T[] | null;
20
+ export declare const last: <T>(a: readonly T[]) => T | null;
21
+ export declare const tail: <T>(a: readonly T[]) => readonly T[] | null;
18
22
  export declare const splitFirst: <T>(a: readonly T[]) => readonly [T, readonly T[]] | null;
19
- export declare const head: <T>(_: readonly T[]) => readonly T[] | null;
20
- export declare const splitLast: <T>(_: readonly T[]) => readonly [readonly T[], T] | null;
21
- export {};
23
+ export declare const head: <T>(a: readonly T[]) => readonly T[] | null;
24
+ export declare const splitLast: <T>(a: readonly T[]) => readonly [readonly T[], T] | null;
@@ -1,20 +1,19 @@
1
- import * as option from "../nullable/module.f.js";
2
- const { map } = option;
3
- const uncheckTail = a => a.slice(1);
4
- const uncheckHead = a => a.slice(0, -1);
5
- export const at = i => a => {
1
+ import { map } from "../nullable/module.f.js";
2
+ const uncheckTail = (a) => a.slice(1);
3
+ const uncheckHead = (a) => a.slice(0, -1);
4
+ export const at = (i) => (a) => {
6
5
  const r = a[i];
7
- return r === void 0 ? null : r;
6
+ return r === undefined ? null : r;
8
7
  };
9
8
  export const first = at(0);
10
- export const last = a => at(a.length - 1)(a);
11
- export const tail = a => a.length === 0 ? null : uncheckTail(a);
9
+ export const last = (a) => at(a.length - 1)(a);
10
+ export const tail = (a) => a.length === 0 ? null : uncheckTail(a);
12
11
  export const splitFirst = (a) => {
13
- const split = first => [first, uncheckTail(a)];
12
+ const split = (first) => [first, uncheckTail(a)];
14
13
  return map(split)(first(a));
15
14
  };
16
- export const head = a => a.length === 0 ? null : uncheckHead(a);
17
- export const splitLast = a => {
15
+ export const head = (a) => a.length === 0 ? null : uncheckHead(a);
16
+ export const splitLast = (a) => {
18
17
  const lastA = last(a);
19
18
  if (lastA === null) {
20
19
  return null;
@@ -6,5 +6,6 @@ declare const _default: {
6
6
  head: (() => void)[];
7
7
  tail: (() => void)[];
8
8
  splitFirst: (() => void)[];
9
+ splitLast: (() => void)[];
9
10
  };
10
11
  export default _default;
@@ -1,7 +1,6 @@
1
- import * as _ from "./module.f.js";
1
+ import { at, first, last, head, tail, splitFirst, splitLast } from "./module.f.js";
2
2
  import * as json from "../../json/module.f.js";
3
- import * as o from "../object/module.f.js";
4
- const { sort } = o;
3
+ import { sort } from "../object/module.f.js";
5
4
  const stringify = json.stringify(sort);
6
5
  export default {
7
6
  stringify: () => {
@@ -12,13 +11,13 @@ export default {
12
11
  },
13
12
  at: [
14
13
  () => {
15
- const result = _.at(2)([1, 20, 300]);
14
+ const result = at(2)([1, 20, 300]);
16
15
  if (result !== 300) {
17
16
  throw result;
18
17
  }
19
18
  },
20
19
  () => {
21
- const result = _.at(3)([1, 20, 300]);
20
+ const result = at(3)([1, 20, 300]);
22
21
  if (result !== null) {
23
22
  throw result;
24
23
  }
@@ -26,13 +25,13 @@ export default {
26
25
  ],
27
26
  first: [
28
27
  () => {
29
- const result = _.first([1, 20, 300]);
28
+ const result = first([1, 20, 300]);
30
29
  if (result !== 1) {
31
30
  throw result;
32
31
  }
33
32
  },
34
33
  () => {
35
- const result = _.first([]);
34
+ const result = first([]);
36
35
  if (result !== null) {
37
36
  throw result;
38
37
  }
@@ -40,13 +39,13 @@ export default {
40
39
  ],
41
40
  last: [
42
41
  () => {
43
- const result = _.last([1, 20, 300]);
42
+ const result = last([1, 20, 300]);
44
43
  if (result !== 300) {
45
44
  throw result;
46
45
  }
47
46
  },
48
47
  () => {
49
- const result = _.last([]);
48
+ const result = last([]);
50
49
  if (result !== null) {
51
50
  throw result;
52
51
  }
@@ -54,7 +53,7 @@ export default {
54
53
  ],
55
54
  head: [
56
55
  () => {
57
- const result = _.head([1, 20, 300]);
56
+ const result = head([1, 20, 300]);
58
57
  if (result === null) {
59
58
  throw result;
60
59
  }
@@ -64,7 +63,7 @@ export default {
64
63
  }
65
64
  },
66
65
  () => {
67
- const result = _.head([]);
66
+ const result = head([]);
68
67
  if (result !== null) {
69
68
  throw result;
70
69
  }
@@ -72,14 +71,14 @@ export default {
72
71
  ],
73
72
  tail: [
74
73
  () => {
75
- const result = _.tail([1, 20, 300]);
74
+ const result = tail([1, 20, 300]);
76
75
  const str = stringify(result);
77
76
  if (str !== '[20,300]') {
78
77
  throw str;
79
78
  }
80
79
  },
81
80
  () => {
82
- const result = _.tail([]);
81
+ const result = tail([]);
83
82
  if (result !== null) {
84
83
  throw result;
85
84
  }
@@ -87,27 +86,29 @@ export default {
87
86
  ],
88
87
  splitFirst: [
89
88
  () => {
90
- const result = _.splitFirst([1, 20, 300]);
89
+ const result = splitFirst([1, 20, 300]);
91
90
  const str = stringify(result);
92
91
  if (str !== '[1,[20,300]]') {
93
92
  throw str;
94
93
  }
95
94
  },
96
95
  () => {
97
- const result = _.splitFirst([]);
96
+ const result = splitFirst([]);
98
97
  if (result !== null) {
99
98
  throw result;
100
99
  }
101
100
  },
101
+ ],
102
+ splitLast: [
102
103
  () => {
103
- const result = _.splitLast([1, 20, 300]);
104
+ const result = splitLast([1, 20, 300]);
104
105
  const str = stringify(result);
105
106
  if (str !== '[[1,20],300]') {
106
107
  throw str;
107
108
  }
108
109
  },
109
110
  () => {
110
- const result = _.splitLast([]);
111
+ const result = splitLast([]);
111
112
  if (result !== null) {
112
113
  throw result;
113
114
  }
@@ -1,3 +1,3 @@
1
1
  export type BigFloat = readonly [bigint, number];
2
- export declare const multiply: (b: BigFloat) => (mul: bigint) => BigFloat;
2
+ export declare const multiply: ([m, e]: BigFloat) => (mul: bigint) => BigFloat;
3
3
  export declare const decToBin: (dec: BigFloat) => BigFloat;