functionalscript 0.1.608 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/Cargo.lock +4 -0
  3. package/Cargo.toml +4 -2
  4. package/README.md +1 -1
  5. package/com/cpp/module.f.d.mts +4 -8
  6. package/com/cpp/module.f.mjs +20 -25
  7. package/com/cpp/testlib.f.mjs +3 -4
  8. package/com/cs/module.f.d.mts +4 -8
  9. package/com/cs/module.f.mjs +18 -23
  10. package/com/cs/testlib.f.mjs +3 -5
  11. package/com/rust/module.f.d.mts +3 -7
  12. package/com/rust/module.f.mjs +25 -30
  13. package/com/rust/nanocom/src/cobject.rs +1 -1
  14. package/com/rust/testlib.f.mjs +3 -5
  15. package/com/test/build.f.d.mts +2 -2
  16. package/com/test/build.f.mjs +2 -2
  17. package/com/test/build.mjs +4 -4
  18. package/com/test/rust/src/lib.rs +4 -4
  19. package/com/types/module.f.d.mts +5 -10
  20. package/com/types/module.f.mjs +5 -12
  21. package/commonjs/build/module.f.d.mts +13 -17
  22. package/commonjs/build/module.f.mjs +23 -28
  23. package/commonjs/build/test.f.mjs +4 -4
  24. package/commonjs/module/function/module.f.d.mts +0 -2
  25. package/commonjs/module/function/module.f.mjs +0 -2
  26. package/commonjs/module/module.f.d.mts +16 -21
  27. package/commonjs/module/module.f.mjs +2 -9
  28. package/commonjs/module.d.mts +1 -5
  29. package/commonjs/module.f.d.mts +0 -2
  30. package/commonjs/module.f.mjs +0 -2
  31. package/commonjs/module.mjs +2 -7
  32. package/commonjs/package/dependencies/module.f.d.mts +3 -7
  33. package/commonjs/package/dependencies/module.f.mjs +5 -10
  34. package/commonjs/package/dependencies/test.f.mjs +1 -1
  35. package/commonjs/package/module.f.d.mts +12 -18
  36. package/commonjs/package/module.f.mjs +6 -13
  37. package/commonjs/package/test.f.mjs +1 -1
  38. package/commonjs/path/module.f.d.mts +25 -32
  39. package/commonjs/path/module.f.mjs +12 -23
  40. package/commonjs/path/test.f.mjs +11 -11
  41. package/commonjs/test.mjs +1 -1
  42. package/dev/module.f.d.mts +1 -4
  43. package/dev/module.f.mjs +1 -4
  44. package/dev/module.mjs +1 -1
  45. package/dev/test/module.f.d.mts +2 -3
  46. package/dev/test/module.f.mjs +5 -7
  47. package/djs/module.f.d.mts +13 -18
  48. package/djs/module.f.mjs +12 -19
  49. package/djs/parser/module.f.d.mts +53 -37
  50. package/djs/parser/module.f.mjs +278 -131
  51. package/djs/parser/test.f.d.mts +4 -0
  52. package/djs/parser/test.f.mjs +186 -70
  53. package/djs/test.f.mjs +4 -4
  54. package/djs/tokenizer/module.f.d.mts +6 -10
  55. package/djs/tokenizer/module.f.mjs +19 -22
  56. package/djs/tokenizer/test.f.mjs +7 -7
  57. package/doc/LANGUAGE.md +17 -16
  58. package/doc/README.md +14 -50
  59. package/fsc/README.md +0 -3
  60. package/fsc/module.f.d.mts +4 -9
  61. package/fsc/module.f.mjs +17 -24
  62. package/fsc/test.f.mjs +3 -3
  63. package/fsm/README.md +1 -1
  64. package/fsm/module.f.d.mts +13 -20
  65. package/fsm/module.f.mjs +27 -38
  66. package/fsm/test.f.mjs +8 -8
  67. package/html/README.md +24 -0
  68. package/html/module.f.d.mts +7 -12
  69. package/html/module.f.mjs +14 -23
  70. package/html/test.f.mjs +4 -4
  71. package/issues/01-test-debug.md +3 -0
  72. package/issues/{publish.md → 05-publish.md} +8 -8
  73. package/issues/17-djs-extension.md +6 -0
  74. package/issues/README.md +20 -13
  75. package/issues/lang/1000-json.md +38 -0
  76. package/issues/lang/2110-default-export.md +2 -2
  77. package/issues/lang/2310-undefined.md +1 -1
  78. package/issues/lang/2330-property-accessor.md +225 -0
  79. package/issues/lang/2360-built-in.md +54 -47
  80. package/issues/lang/3240-export.md +44 -0
  81. package/issues/lang/README.md +64 -22
  82. package/issues/test.f.d.mts +16 -0
  83. package/issues/test.f.mjs +57 -0
  84. package/js/tokenizer/module.f.d.mts +18 -17
  85. package/js/tokenizer/module.f.mjs +80 -61
  86. package/js/tokenizer/test.f.mjs +15 -12
  87. package/json/module.f.d.mts +18 -26
  88. package/json/module.f.mjs +18 -31
  89. package/json/parser/module.f.d.mts +9 -13
  90. package/json/parser/module.f.mjs +9 -14
  91. package/json/parser/test.f.mjs +7 -7
  92. package/json/serializer/module.f.d.mts +11 -20
  93. package/json/serializer/module.f.mjs +14 -29
  94. package/json/serializer/test.f.mjs +2 -2
  95. package/json/test.f.mjs +3 -3
  96. package/json/tokenizer/module.f.d.mts +6 -10
  97. package/json/tokenizer/module.f.mjs +16 -20
  98. package/json/tokenizer/test.f.mjs +6 -6
  99. package/jsr.json +1 -1
  100. package/nanvm-lib/Cargo.toml +6 -0
  101. package/nanvm-lib/src/extension.rs +119 -0
  102. package/nanvm-lib/src/interface.rs +136 -0
  103. package/nanvm-lib/src/lib.rs +7 -0
  104. package/nanvm-lib/src/naive.rs +229 -0
  105. package/nanvm-lib/src/nanenum.rs +230 -0
  106. package/nanvm-lib/src/nullish.rs +7 -0
  107. package/nanvm-lib/src/sign.rs +5 -0
  108. package/nanvm-lib/src/simple.rs +32 -0
  109. package/nanvm-lib/tests/test.f.d.mts +36 -0
  110. package/nanvm-lib/tests/test.f.mjs +79 -0
  111. package/nanvm-lib/tests/test.rs +108 -0
  112. package/nodejs/version/main.mjs +1 -1
  113. package/nodejs/version/module.f.d.mts +4 -9
  114. package/nodejs/version/module.f.mjs +2 -7
  115. package/nodejs/version/test.f.mjs +3 -3
  116. package/package.json +1 -1
  117. package/prime_field/module.f.d.mts +20 -23
  118. package/prime_field/module.f.mjs +9 -12
  119. package/prime_field/test.f.mjs +1 -1
  120. package/secp/module.f.d.mts +27 -28
  121. package/secp/module.f.mjs +38 -39
  122. package/secp/test.f.mjs +4 -4
  123. package/sha2/module.f.d.mts +8 -16
  124. package/sha2/module.f.mjs +7 -20
  125. package/sha2/test.f.mjs +4 -4
  126. package/text/README.md +2 -2
  127. package/text/ascii/module.f.d.mts +69 -72
  128. package/text/ascii/module.f.mjs +5 -10
  129. package/text/ascii/test.f.mjs +3 -3
  130. package/text/module.f.d.mts +9 -14
  131. package/text/module.f.mjs +7 -14
  132. package/text/sgr/module.f.d.mts +7 -9
  133. package/text/sgr/module.f.mjs +2 -4
  134. package/text/test.f.mjs +3 -3
  135. package/text/utf16/module.f.d.mts +8 -15
  136. package/text/utf16/module.f.mjs +17 -28
  137. package/text/utf16/test.f.mjs +5 -5
  138. package/text/utf8/module.f.d.mts +4 -9
  139. package/text/utf8/module.f.mjs +9 -16
  140. package/text/utf8/test.f.mjs +4 -4
  141. package/types/array/module.f.d.mts +14 -24
  142. package/types/array/module.f.mjs +8 -25
  143. package/types/array/test.f.mjs +3 -3
  144. package/types/bigfloat/module.f.d.mts +4 -9
  145. package/types/bigfloat/module.f.mjs +3 -10
  146. package/types/bigfloat/test.f.mjs +1 -1
  147. package/types/bigint/module.f.d.mts +16 -64
  148. package/types/bigint/module.f.mjs +11 -30
  149. package/types/bigint/test.f.mjs +1 -1
  150. package/types/btree/find/module.f.d.mts +20 -26
  151. package/types/btree/find/module.f.mjs +8 -17
  152. package/types/btree/find/test.f.mjs +7 -7
  153. package/types/btree/module.f.d.mts +4 -8
  154. package/types/btree/module.f.mjs +6 -11
  155. package/types/btree/remove/module.f.d.mts +7 -12
  156. package/types/btree/remove/module.f.mjs +10 -17
  157. package/types/btree/remove/test.f.mjs +5 -5
  158. package/types/btree/set/module.f.d.mts +3 -7
  159. package/types/btree/set/module.f.mjs +4 -9
  160. package/types/btree/set/test.f.mjs +4 -4
  161. package/types/btree/test.f.mjs +9 -9
  162. package/types/btree/types/module.f.d.mts +0 -2
  163. package/types/btree/types/module.f.mjs +0 -2
  164. package/types/byte_set/module.f.d.mts +16 -29
  165. package/types/byte_set/module.f.mjs +14 -39
  166. package/types/byte_set/test.f.mjs +5 -5
  167. package/types/function/compare/module.f.d.mts +9 -15
  168. package/types/function/compare/module.f.mjs +3 -12
  169. package/types/function/compare/test.f.mjs +1 -1
  170. package/types/function/module.f.d.mts +20 -27
  171. package/types/function/module.f.mjs +4 -15
  172. package/types/function/operator/module.f.d.mts +28 -43
  173. package/types/function/operator/module.f.mjs +14 -41
  174. package/types/function/test.f.mjs +1 -1
  175. package/types/list/module.f.d.mts +56 -91
  176. package/types/list/module.f.mjs +45 -114
  177. package/types/list/test.f.mjs +10 -10
  178. package/types/map/module.f.d.mts +15 -24
  179. package/types/map/module.f.mjs +15 -30
  180. package/types/map/test.f.mjs +2 -2
  181. package/types/nibble_set/module.f.d.mts +10 -20
  182. package/types/nibble_set/module.f.mjs +7 -24
  183. package/types/nibble_set/test.f.mjs +2 -2
  184. package/types/nullable/module.f.d.mts +3 -8
  185. package/types/nullable/module.f.mjs +2 -9
  186. package/types/nullable/test.f.mjs +1 -1
  187. package/types/number/module.f.d.mts +7 -13
  188. package/types/number/module.f.mjs +8 -19
  189. package/types/number/test.f.mjs +1 -1
  190. package/types/object/module.f.d.mts +11 -18
  191. package/types/object/module.f.mjs +9 -20
  192. package/types/object/test.f.mjs +1 -1
  193. package/types/range/module.f.d.mts +3 -8
  194. package/types/range/module.f.mjs +2 -9
  195. package/types/range/test.f.mjs +1 -1
  196. package/types/range_map/module.f.d.mts +9 -15
  197. package/types/range_map/module.f.mjs +9 -18
  198. package/types/range_map/test.f.mjs +32 -32
  199. package/types/result/module.d.mts +3 -3
  200. package/types/result/module.f.d.mts +6 -12
  201. package/types/result/module.f.mjs +3 -12
  202. package/types/result/module.mjs +2 -2
  203. package/types/sorted_list/module.f.d.mts +22 -28
  204. package/types/sorted_list/module.f.mjs +10 -19
  205. package/types/sorted_list/test.f.mjs +7 -7
  206. package/types/sorted_set/module.f.d.mts +6 -12
  207. package/types/sorted_set/module.f.mjs +7 -16
  208. package/types/sorted_set/test.f.mjs +7 -7
  209. package/types/string/module.f.d.mts +8 -14
  210. package/types/string/module.f.mjs +10 -21
  211. package/types/string/test.f.mjs +2 -2
  212. package/types/string_set/module.f.d.mts +8 -16
  213. package/types/string_set/module.f.mjs +12 -27
  214. package/types/string_set/test.f.mjs +1 -1
  215. package/issues/lang/2351-property-accessor.md +0 -44
  216. package/issues/lang/2352-property-call.md +0 -43
  217. package/issues/lang/2353-property-at.md +0 -19
  218. package/issues/test-debug.md +0 -12
  219. /package/issues/{esm.md → 02-esm.md} +0 -0
  220. /package/issues/{djs.md → 03-djs.md} +0 -0
  221. /package/issues/{fs-load.md → 11-fs-load.md} +0 -0
  222. /package/issues/lang/{2330-grouping.md → 2350-grouping.md} +0 -0
@@ -1,9 +1,9 @@
1
1
  // @ts-self-types="./module.f.d.mts"
2
2
  import * as _ from '../types/module.f.mjs'
3
- import btreeFind, * as BtreeFind from '../find/module.f.mjs'
3
+ import * as btreeFind from '../find/module.f.mjs'
4
4
  const { find } = btreeFind
5
5
  import * as Cmp from '../../function/compare/module.f.mjs'
6
- import list from '../../list/module.f.mjs'
6
+ import * as list from '../../list/module.f.mjs'
7
7
  const { fold } = list
8
8
 
9
9
  /**
@@ -14,7 +14,7 @@ const { fold } = list
14
14
  /** @type {<T>(b: _.Branch5<T> | _.Branch7<T>) => Branch1To3<T>} */
15
15
  const b57 = b => b.length === 5 ? [b] : [[b[0], b[1], b[2]], b[3], [b[4], b[5], b[6]]]
16
16
 
17
- /** @type {<T>(i: BtreeFind.PathItem<T>) => (a: Branch1To3<T>) => Branch1To3<T>} */
17
+ /** @type {<T>(i: btreeFind.PathItem<T>) => (a: Branch1To3<T>) => Branch1To3<T>} */
18
18
  const reduceOp = ([i, x]) => a => {
19
19
  switch (i) {
20
20
  case 0: {
@@ -89,9 +89,4 @@ const nodeSet = c => g => node => {
89
89
  }
90
90
 
91
91
  /** @type {<T>(c: Cmp.Compare<T>) => (f: (value: T|null) => T) => (tree: _.Tree<T>) => _.Node<T>} */
92
- const set = c => f => tree => tree === null ? [f(null)] : nodeSet(c)(f)(tree)
93
-
94
- export default {
95
- /** @readonly */
96
- set,
97
- }
92
+ export const set = c => f => tree => tree === null ? [f(null)] : nodeSet(c)(f)(tree)
@@ -1,9 +1,9 @@
1
- import _ from './module.f.mjs'
1
+ import * as _ from './module.f.mjs'
2
2
  import * as BTree from '../types/module.f.mjs'
3
- import s from '../../string/module.f.mjs'
3
+ import * as s from '../../string/module.f.mjs'
4
4
  const { cmp } = s
5
- import json from '../../../json/module.f.mjs'
6
- import o from '../../object/module.f.mjs'
5
+ import * as json from '../../../json/module.f.mjs'
6
+ import * as o from '../../object/module.f.mjs'
7
7
  const { sort } = o
8
8
 
9
9
  /** @type {(node: BTree.Node<string>) => (value: string) => BTree.Node<string>} */
@@ -1,18 +1,18 @@
1
1
  import * as BTree from './types/module.f.mjs'
2
- import _ from './module.f.mjs'
2
+ import * as _ from './module.f.mjs'
3
3
  const { values } = _
4
- import json, * as jsonT from '../../json/module.f.mjs'
5
- import o from '../object/module.f.mjs'
4
+ import * as json from '../../json/module.f.mjs'
5
+ import * as o from '../object/module.f.mjs'
6
6
  const { sort } = o
7
- import str from '../string/module.f.mjs'
7
+ import * as str from '../string/module.f.mjs'
8
8
  const { cmp } = str
9
- import list, * as List from '../list/module.f.mjs'
10
- import s from './set/module.f.mjs'
11
- import f from './find/module.f.mjs'
9
+ import * as list from '../list/module.f.mjs'
10
+ import * as s from './set/module.f.mjs'
11
+ import * as f from './find/module.f.mjs'
12
12
 
13
13
  const jsonStr = json.stringify(sort)
14
14
 
15
- /** @type {(sequence: List.List<jsonT.Unknown>) => string} */
15
+ /** @type {(sequence: list.List<json.Unknown>) => string} */
16
16
  const stringify = sequence => jsonStr(list.toArray(sequence))
17
17
 
18
18
  /** @type {(node: BTree.Node<string>) => (value: string) => BTree.Node<string>} */
@@ -67,7 +67,7 @@ const test = () => {
67
67
  _map = set(_map)('f')
68
68
  //
69
69
  {
70
- /** @type {List.Result<string>} */
70
+ /** @type {list.Result<string>} */
71
71
  let _item = list.next(values(_map))
72
72
  while (_item !== null) {
73
73
  _item = list.next(_item.tail)
@@ -1,5 +1,3 @@
1
- declare const _default: {};
2
- export default _default;
3
1
  export type Array1<T> = readonly [T];
4
2
  export type Array2<T> = readonly [T, T];
5
3
  export type Array3<T> = readonly [T, T, T];
@@ -62,5 +62,3 @@
62
62
  * @template T
63
63
  * @typedef { readonly[...Branch5<T>, T, Node<T>] } Branch7
64
64
  */
65
-
66
- export default {}
@@ -1,38 +1,25 @@
1
- declare namespace _default {
2
- export { empty };
3
- export { universe };
4
- export { has };
5
- export { set };
6
- export { unset };
7
- export { one };
8
- export { union };
9
- export { setRange };
10
- export { range };
11
- export { complement };
12
- export { toRangeMap };
13
- }
14
- export default _default;
15
- export type ByteSet = bigint;
16
- export type Byte = number;
17
- declare const empty: 0n;
18
- declare const universe: 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn;
19
1
  /** @typedef {bigint} ByteSet */
20
2
  /** @typedef {number} Byte */
21
3
  /** @type {(n: Byte) => (s: ByteSet) => boolean} */
22
- 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;
4
+ export const has: (n: Byte) => (s: ByteSet) => boolean;
5
+ export const empty: 0n;
6
+ export const universe: 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn;
26
7
  /** @type {(n: Byte) => ByteSet} */
27
- 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>;
8
+ export const one: (n: Byte) => ByteSet;
31
9
  /** @type {(r: readonly[Byte, Byte]) => ByteSet} */
32
- declare const range: (r: readonly [Byte, Byte]) => ByteSet;
10
+ export const range: (r: readonly [Byte, Byte]) => ByteSet;
11
+ /** @type {(a: ByteSet) => (b: ByteSet) => ByteSet} */
12
+ export const union: (a: ByteSet) => (b: ByteSet) => ByteSet;
33
13
  /** @type {(n: ByteSet) => ByteSet} */
34
- declare const complement: (n: ByteSet) => ByteSet;
14
+ export const complement: (n: ByteSet) => ByteSet;
15
+ export const set: f.Func<number, (b: ByteSet) => ByteSet>;
16
+ export const setRange: f.Func<readonly [number, number], (b: ByteSet) => ByteSet>;
17
+ /** @type {(n: Byte) => (s: ByteSet) => ByteSet} */
18
+ export const unset: (n: Byte) => (s: ByteSet) => ByteSet;
35
19
  /** @type {(n: ByteSet) => (s: string) => RangeMap.RangeMap<SortedSet.SortedSet<string>>} */
36
- declare const toRangeMap: (n: ByteSet) => (s: string) => RangeMap.RangeMap<SortedSet.SortedSet<string>>;
20
+ export const toRangeMap: (n: ByteSet) => (s: string) => RangeMap.RangeMap<SortedSet.SortedSet<string>>;
21
+ export type ByteSet = bigint;
22
+ export type Byte = number;
23
+ import * as f from '../function/module.f.mjs';
37
24
  import * as RangeMap from '../range_map/module.f.mjs';
38
25
  import * as SortedSet from '../sorted_set/module.f.mjs';
@@ -1,52 +1,52 @@
1
1
  // @ts-self-types="./module.f.d.mts"
2
- import f from '../function/module.f.mjs'
2
+ import * as f from '../function/module.f.mjs'
3
3
  const { compose } = f
4
4
  import * as RangeMap from '../range_map/module.f.mjs'
5
5
  import * as SortedSet from '../sorted_set/module.f.mjs'
6
- import list from '../list/module.f.mjs'
6
+ import * as list from '../list/module.f.mjs'
7
7
  const { reverse, countdown, flat, map } = list
8
8
 
9
9
  /** @typedef {bigint} ByteSet */
10
10
  /** @typedef {number} Byte */
11
11
 
12
12
  /** @type {(n: Byte) => (s: ByteSet) => boolean} */
13
- const has = n => s => ((s >> BigInt(n)) & 1n) === 1n
13
+ export const has = n => s => ((s >> BigInt(n)) & 1n) === 1n
14
14
 
15
15
  // create a set
16
16
 
17
- const empty = 0n
17
+ export const empty = 0n
18
18
 
19
- // 0 1 2 3 4 5 6 7 8 9 A B C D E F
20
- const universe = 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFFn
19
+ // 0 1 2 3 4 5 6 7 8 9 A B C D E F
20
+ export const universe = 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFFn
21
21
 
22
22
  /** @type {(n: Byte) => ByteSet} */
23
- const one = n => 1n << BigInt(n)
23
+ export const one = n => 1n << BigInt(n)
24
24
 
25
25
  /** @type {(r: readonly[Byte, Byte]) => ByteSet} */
26
- const range = ([b, e]) => one(e - b + 1) - 1n << BigInt(b)
26
+ export const range = ([b, e]) => one(e - b + 1) - 1n << BigInt(b)
27
27
 
28
28
  // set operations
29
29
 
30
30
  /** @type {(a: ByteSet) => (b: ByteSet) => ByteSet} */
31
- const union = a => b => a | b
31
+ export const union = a => b => a | b
32
32
 
33
33
  /** @type {(a: ByteSet) => (b: ByteSet) => ByteSet} */
34
34
  const intersect = a => b => a & b
35
35
 
36
36
  /** @type {(n: ByteSet) => ByteSet} */
37
- const complement = n => universe ^ n
37
+ export const complement = n => universe ^ n
38
38
 
39
39
  /** @type {(a: ByteSet) => (b: ByteSet) => ByteSet} */
40
40
  const difference = compose(intersect)(compose(complement))
41
41
 
42
42
  // additional operations
43
43
 
44
- const set = compose(one)(union)
44
+ export const set = compose(one)(union)
45
45
 
46
- const setRange = compose(range)(union)
46
+ export const setRange = compose(range)(union)
47
47
 
48
48
  /** @type {(n: Byte) => (s: ByteSet) => ByteSet} */
49
- const unset = n => s => difference(s)(one(n))
49
+ export const unset = n => s => difference(s)(one(n))
50
50
 
51
51
  const counter = reverse(countdown(256))
52
52
 
@@ -58,29 +58,4 @@ const toRangeMapOp = n => s => i => {
58
58
  }
59
59
 
60
60
  /** @type {(n: ByteSet) => (s: string) => RangeMap.RangeMap<SortedSet.SortedSet<string>>} */
61
- const toRangeMap = n => s => flat(map(toRangeMapOp(n)(s))(counter))
62
-
63
- export default {
64
- /** @readonly */
65
- empty,
66
- /** @readonly */
67
- universe,
68
- /** @readonly */
69
- has,
70
- /** @readonly */
71
- set,
72
- /** @readonly */
73
- unset,
74
- /** @readonly */
75
- one,
76
- /** @readonly */
77
- union,
78
- /** @readonly */
79
- setRange,
80
- /** @readonly */
81
- range,
82
- /** @readonly */
83
- complement,
84
- /** @readonly */
85
- toRangeMap,
86
- }
61
+ export const toRangeMap = n => s => flat(map(toRangeMapOp(n)(s))(counter))
@@ -1,11 +1,11 @@
1
- import _ from './module.f.mjs'
2
- import list from '../list/module.f.mjs'
1
+ import * as _ from './module.f.mjs'
2
+ import * as list from '../list/module.f.mjs'
3
3
  const { every, countdown, map, toArray } = list
4
- import json, * as Json from '../../json/module.f.mjs'
5
- import o from '../object/module.f.mjs'
4
+ import * as json from '../../json/module.f.mjs'
5
+ import * as o from '../object/module.f.mjs'
6
6
  const { sort } = o
7
7
 
8
- /** @type {(a: readonly Json.Unknown[]) => string} */
8
+ /** @type {(a: readonly json.Unknown[]) => string} */
9
9
  const stringify = json.stringify(sort)
10
10
 
11
11
  export default {
@@ -1,16 +1,3 @@
1
- declare namespace _default {
2
- export { unsafeCmp };
3
- export { index3 };
4
- export { index5 };
5
- }
6
- export default _default;
7
- export type Index3 = Array.Index3;
8
- export type Index5 = Array.Index5;
9
- export type Array2<T> = Array.Array2<T>;
10
- export type Sign = -1 | 0 | 1;
11
- export type Compare<T> = (_: T) => Sign;
12
- /** @type {<T>(a: T) => (b: T) => Sign} */
13
- declare const unsafeCmp: <T>(a: T) => (b: T) => Sign;
14
1
  /** @typedef {Array.Index3} Index3 */
15
2
  /** @typedef {Array.Index5} Index5 */
16
3
  /**
@@ -23,7 +10,14 @@ declare const unsafeCmp: <T>(a: T) => (b: T) => Sign;
23
10
  * @typedef {(_: T) => Sign} Compare
24
11
  */
25
12
  /** @type {<T>(cmp: Compare<T>) => (value: T) => Index3} */
26
- declare const index3: <T>(cmp: Compare<T>) => (value: T) => Index3;
13
+ export const index3: <T>(cmp: Compare<T>) => (value: T) => Index3;
27
14
  /** @type {<T>(cmp: Compare<T>) => (v2: Array2<T>) => Index5} */
28
- declare const index5: <T>(cmp: Compare<T>) => (v2: Array2<T>) => Index5;
15
+ export const index5: <T>(cmp: Compare<T>) => (v2: Array2<T>) => Index5;
16
+ /** @type {<T>(a: T) => (b: T) => Sign} */
17
+ export const unsafeCmp: <T>(a: T) => (b: T) => Sign;
18
+ export type Index3 = Array.Index3;
19
+ export type Index5 = Array.Index5;
20
+ export type Array2<T> = Array.Array2<T>;
21
+ export type Sign = -1 | 0 | 1;
22
+ export type Compare<T> = (_: T) => Sign;
29
23
  import * as Array from '../../array/module.f.mjs';
@@ -17,22 +17,13 @@ import * as Array from '../../array/module.f.mjs'
17
17
  */
18
18
 
19
19
  /** @type {<T>(cmp: Compare<T>) => (value: T) => Index3} */
20
- const index3 = cmp => value => /** @type {Index3} */ (cmp(value) + 1)
20
+ export const index3 = cmp => value => /** @type {Index3} */ (cmp(value) + 1)
21
21
 
22
22
  /** @type {<T>(cmp: Compare<T>) => (v2: Array2<T>) => Index5} */
23
- const index5 = cmp => ([v0, v1]) => {
23
+ export const index5 = cmp => ([v0, v1]) => {
24
24
  const _0 = cmp(v0)
25
25
  return /** @type {Index5} */ (_0 <= 0 ? _0 + 1 : cmp(v1) + 3)
26
26
  }
27
27
 
28
28
  /** @type {<T>(a: T) => (b: T) => Sign} */
29
- const unsafeCmp = a => b => a < b ? -1 : a > b ? 1 : 0
30
-
31
- export default {
32
- /** @readonly */
33
- unsafeCmp,
34
- /** @readonly */
35
- index3,
36
- /** @readonly */
37
- index5,
38
- }
29
+ export const unsafeCmp = a => b => a < b ? -1 : a > b ? 1 : 0
@@ -1,4 +1,4 @@
1
- import _ from './module.f.mjs'
1
+ import * as _ from './module.f.mjs'
2
2
  const { unsafeCmp } = _
3
3
 
4
4
  export default () => {
@@ -1,27 +1,3 @@
1
- declare namespace _default {
2
- export { identity };
3
- export { compose };
4
- export { flip };
5
- export { fn };
6
- }
7
- export default _default;
8
- /**
9
- * A generic function type.
10
- */
11
- export type Func<I, O> = (_: I) => O;
12
- /**
13
- * A functional utility type that enables seamless chaining of transformations.
14
- */
15
- export type Fn<I, O> = {
16
- readonly result: Func<I, O>;
17
- readonly then: <T>(g: Func<O, T>) => Fn<I, T>;
18
- };
19
- /**
20
- * A generic identity function.
21
- *
22
- * @type {<T>(value: T) => T}
23
- */
24
- declare const identity: <T>(value: T) => T;
25
1
  /**
26
2
  * A generic function type.
27
3
  *
@@ -34,13 +10,19 @@ declare const identity: <T>(value: T) => T;
34
10
  *
35
11
  * @type {<I, X>(g: Func<I, X>) => <O>(f: Func<X, O>) => Func<I, O>}
36
12
  */
37
- declare const compose: <I, X>(g: Func<I, X>) => <O>(f: Func<X, O>) => Func<I, O>;
13
+ export const compose: <I, X>(g: Func<I, X>) => <O>(f: Func<X, O>) => Func<I, O>;
14
+ /**
15
+ * A generic identity function.
16
+ *
17
+ * @type {<T>(value: T) => T}
18
+ */
19
+ export const identity: <T>(value: T) => T;
38
20
  /**
39
21
  * Flips the arguments of a curried function.
40
22
  *
41
23
  * @type {<A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C}
42
24
  */
43
- declare const flip: <A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C;
25
+ export const flip: <A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C;
44
26
  /**
45
27
  * A functional utility type that enables seamless chaining of transformations.
46
28
  *
@@ -55,4 +37,15 @@ declare const flip: <A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C
55
37
  *
56
38
  * @type {<I, O>(f: (i: I) => O) => Fn<I, O>}
57
39
  */
58
- declare const fn: <I, O>(f: (i: I) => O) => Fn<I, O>;
40
+ export const fn: <I, O>(f: (i: I) => O) => Fn<I, O>;
41
+ /**
42
+ * A generic function type.
43
+ */
44
+ export type Func<I, O> = (_: I) => O;
45
+ /**
46
+ * A functional utility type that enables seamless chaining of transformations.
47
+ */
48
+ export type Fn<I, O> = {
49
+ readonly result: Func<I, O>;
50
+ readonly then: <T>(g: Func<O, T>) => Fn<I, T>;
51
+ };
@@ -13,21 +13,21 @@
13
13
  *
14
14
  * @type {<I, X>(g: Func<I, X>) => <O>(f: Func<X, O>) => Func<I, O>}
15
15
  */
16
- const compose = g => f => x => f(g(x))
16
+ export const compose = g => f => x => f(g(x))
17
17
 
18
18
  /**
19
19
  * A generic identity function.
20
20
  *
21
21
  * @type {<T>(value: T) => T}
22
22
  */
23
- const identity = value => value
23
+ export const identity = value => value
24
24
 
25
25
  /**
26
26
  * Flips the arguments of a curried function.
27
27
  *
28
28
  * @type {<A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C}
29
29
  */
30
- const flip = f => b => a => f(a)(b)
30
+ export const flip = f => b => a => f(a)(b)
31
31
 
32
32
  /**
33
33
  * A functional utility type that enables seamless chaining of transformations.
@@ -44,18 +44,7 @@ const flip = f => b => a => f(a)(b)
44
44
  *
45
45
  * @type {<I, O>(f: (i: I) => O) => Fn<I, O>}
46
46
  */
47
- const fn = result => ({
47
+ export const fn = result => ({
48
48
  result,
49
49
  then: g => fn(compose(result)(g))
50
50
  })
51
-
52
- export default {
53
- /** @readonly */
54
- identity,
55
- /** @readonly */
56
- compose,
57
- /** @readonly */
58
- flip,
59
- /** @readonly */
60
- fn,
61
- }
@@ -1,25 +1,3 @@
1
- declare namespace _default {
2
- export { join };
3
- export { addition };
4
- export { increment };
5
- export { strictEqual };
6
- export { logicalNot };
7
- export { min };
8
- export { max };
9
- export { stateScanToScan };
10
- export { foldToScan };
11
- export { reduceToScan };
12
- export { counter };
13
- export { concat };
14
- }
15
- export default _default;
16
- export type Binary<A, B, R> = (a: A) => (b: B) => R;
17
- export type Fold<I, O> = Binary<I, O, O>;
18
- export type Unary<T, R> = (value: T) => R;
19
- export type Equal<T> = Binary<T, T, boolean>;
20
- export type Scan<I, O> = (input: I) => readonly [O, Scan<I, O>];
21
- export type StateScan<I, S, O> = (prior: S) => (input: I) => readonly [O, S];
22
- export type Reduce<T> = Fold<T, T>;
23
1
  /**
24
2
  * @template A
25
3
  * @template B
@@ -31,27 +9,22 @@ export type Reduce<T> = Fold<T, T>;
31
9
  * @typedef {Binary<I, O, O>} Fold
32
10
  */
33
11
  /** @type {(separator: string) => Reduce<string>} */
34
- declare const join: (separator: string) => Reduce<string>;
35
- /** @type {Reduce<number>} */
36
- declare const addition: Reduce<number>;
37
- declare const increment: (b: number) => number;
38
- /**
39
- * @template T
40
- * @typedef {Binary<T, T, boolean>} Equal
41
- */
42
- /** @type {<T>(a: T) => (b: T) => boolean} */
43
- declare const strictEqual: <T>(a: T) => (b: T) => boolean;
12
+ export const join: (separator: string) => Reduce<string>;
13
+ /** @type {Reduce<string>} */
14
+ export const concat: Reduce<string>;
44
15
  /**
45
16
  * @template T
46
17
  * @template R
47
18
  * @typedef {(value: T) => R} Unary
48
19
  */
49
20
  /** @type {Unary<boolean, boolean>} */
50
- declare const logicalNot: Unary<boolean, boolean>;
51
- /** @type {Reduce<number>} */
52
- declare const min: Reduce<number>;
53
- /** @type {Reduce<number>} */
54
- declare const max: Reduce<number>;
21
+ export const logicalNot: Unary<boolean, boolean>;
22
+ /**
23
+ * @template T
24
+ * @typedef {Binary<T, T, boolean>} Equal
25
+ */
26
+ /** @type {<T>(a: T) => (b: T) => boolean} */
27
+ export const strictEqual: <T>(a: T) => (b: T) => boolean;
55
28
  /**
56
29
  * @template I,O
57
30
  * @typedef {(input: I) => readonly[O, Scan<I,O>]} Scan
@@ -61,15 +34,27 @@ declare const max: Reduce<number>;
61
34
  * @typedef {(prior: S) => (input: I) => readonly[O, S]} StateScan
62
35
  */
63
36
  /** @type {<I, S, O>(op: StateScan<I, S, O>) => (prior: S) => Scan<I, O>} */
64
- declare const stateScanToScan: <I, S, O>(op: StateScan<I, S, O>) => (prior: S) => Scan<I, O>;
37
+ export const stateScanToScan: <I, S, O>(op: StateScan<I, S, O>) => (prior: S) => Scan<I, O>;
65
38
  /** @type {<I, O>(fold: Fold<I, O>) => (prior: O) => Scan<I, O>} */
66
- declare const foldToScan: <I, O>(fold: Fold<I, O>) => (prior: O) => Scan<I, O>;
39
+ export const foldToScan: <I, O>(fold: Fold<I, O>) => (prior: O) => Scan<I, O>;
67
40
  /**
68
41
  * @template T
69
42
  * @typedef {Fold<T, T>} Reduce
70
43
  */
71
44
  /** @type {<T>(fold: Reduce<T>) => Scan<T, T>} */
72
- declare const reduceToScan: <T>(fold: Reduce<T>) => Scan<T, T>;
73
- declare function counter(): (b: number) => number;
74
- /** @type {Reduce<string>} */
75
- declare const concat: Reduce<string>;
45
+ export const reduceToScan: <T>(fold: Reduce<T>) => Scan<T, T>;
46
+ /** @type {Reduce<number>} */
47
+ export const addition: Reduce<number>;
48
+ /** @type {Reduce<number>} */
49
+ export const min: Reduce<number>;
50
+ /** @type {Reduce<number>} */
51
+ export const max: Reduce<number>;
52
+ export const increment: (b: number) => number;
53
+ export function counter(): (b: number) => number;
54
+ export type Binary<A, B, R> = (a: A) => (b: B) => R;
55
+ export type Fold<I, O> = Binary<I, O, O>;
56
+ export type Unary<T, R> = (value: T) => R;
57
+ export type Equal<T> = Binary<T, T, boolean>;
58
+ export type Scan<I, O> = (input: I) => readonly [O, Scan<I, O>];
59
+ export type StateScan<I, S, O> = (prior: S) => (input: I) => readonly [O, S];
60
+ export type Reduce<T> = Fold<T, T>;
@@ -12,10 +12,10 @@
12
12
  */
13
13
 
14
14
  /** @type {(separator: string) => Reduce<string>} */
15
- const join = separator => value => prior => `${prior}${separator}${value}`
15
+ export const join = separator => value => prior => `${prior}${separator}${value}`
16
16
 
17
17
  /** @type {Reduce<string>} */
18
- const concat = i => acc => `${acc}${i}`
18
+ export const concat = i => acc => `${acc}${i}`
19
19
 
20
20
  /**
21
21
  * @template T
@@ -24,7 +24,7 @@ const concat = i => acc => `${acc}${i}`
24
24
  */
25
25
 
26
26
  /** @type {Unary<boolean, boolean>} */
27
- const logicalNot = v => !v
27
+ export const logicalNot = v => !v
28
28
 
29
29
  /**
30
30
  * @template T
@@ -32,7 +32,7 @@ const logicalNot = v => !v
32
32
  */
33
33
 
34
34
  /** @type {<T>(a: T) => (b: T) => boolean} */
35
- const strictEqual = a => b => a === b
35
+ export const strictEqual = a => b => a === b
36
36
 
37
37
  /**
38
38
  * @template I,O
@@ -45,13 +45,13 @@ const strictEqual = a => b => a === b
45
45
  */
46
46
 
47
47
  /** @type {<I, S, O>(op: StateScan<I, S, O>) => (prior: S) => Scan<I, O>} */
48
- const stateScanToScan = op => prior => i => {
48
+ export const stateScanToScan = op => prior => i => {
49
49
  const [o, s] = op(prior)(i)
50
50
  return [o, stateScanToScan(op)(s)]
51
51
  }
52
52
 
53
53
  /** @type {<I, O>(fold: Fold<I, O>) => (prior: O) => Scan<I, O>} */
54
- const foldToScan = fold => prior => i => {
54
+ export const foldToScan = fold => prior => i => {
55
55
  const result = fold(i)(prior)
56
56
  return [result, foldToScan(fold)(result)]
57
57
  }
@@ -62,44 +62,17 @@ const foldToScan = fold => prior => i => {
62
62
  */
63
63
 
64
64
  /** @type {<T>(fold: Reduce<T>) => Scan<T, T>} */
65
- const reduceToScan = op => init => [init, foldToScan(op)(init)]
65
+ export const reduceToScan = op => init => [init, foldToScan(op)(init)]
66
66
 
67
67
  /** @type {Reduce<number>} */
68
- const addition = a => b => a + b
68
+ export const addition = a => b => a + b
69
69
 
70
70
  /** @type {Reduce<number>} */
71
- const min = a => b => a < b ? a : b
71
+ export const min = a => b => a < b ? a : b
72
72
 
73
73
  /** @type {Reduce<number>} */
74
- const max = a => b => a > b ? a : b
75
-
76
- const increment = addition(1)
77
-
78
- const counter = () => increment
79
-
80
- export default {
81
- /** @readonly */
82
- join,
83
- /** @readonly */
84
- addition,
85
- /** @readonly */
86
- increment,
87
- /** @readonly */
88
- strictEqual,
89
- /** @readonly */
90
- logicalNot,
91
- /** @readonly */
92
- min,
93
- /** @readonly */
94
- max,
95
- /** @readonly */
96
- stateScanToScan,
97
- /** @readonly */
98
- foldToScan,
99
- /** @readonly */
100
- reduceToScan,
101
- /** @readonly */
102
- counter,
103
- /** @readonly */
104
- concat,
105
- }
74
+ export const max = a => b => a > b ? a : b
75
+
76
+ export const increment = addition(1)
77
+
78
+ export const counter = () => increment
@@ -1,4 +1,4 @@
1
- import _ from './module.f.mjs'
1
+ import * as _ from './module.f.mjs'
2
2
 
3
3
  const { fn } = _
4
4