functionalscript 0.0.592 → 0.1.594

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 (136) hide show
  1. package/.github/workflows/ci.yml +3 -3
  2. package/README.md +1 -0
  3. package/com/cpp/{module.f.cjs → module.f.mjs} +22 -21
  4. package/com/cpp/{test.f.cjs → test.f.mjs} +2 -2
  5. package/com/cpp/testlib.f.mjs +9 -0
  6. package/com/cs/{module.f.cjs → module.f.mjs} +20 -19
  7. package/com/cs/{test.f.cjs → test.f.mjs} +2 -2
  8. package/com/cs/testlib.f.mjs +10 -0
  9. package/com/rust/{module.f.cjs → module.f.mjs} +37 -35
  10. package/com/rust/{test.f.cjs → test.f.mjs} +2 -2
  11. package/com/rust/testlib.f.mjs +10 -0
  12. package/com/test/{build.f.cjs → build.f.mjs} +6 -6
  13. package/com/test/{build.cjs → build.mjs} +16 -8
  14. package/com/types/{module.f.cjs → module.f.mjs} +9 -8
  15. package/com/types/{testlib.f.cjs → testlib.f.mjs} +2 -2
  16. package/commonjs/build/{module.f.cjs → module.f.mjs} +23 -23
  17. package/commonjs/build/{test.f.cjs → test.f.mjs} +13 -12
  18. package/commonjs/module/function/{module.f.cjs → module.f.mjs} +4 -4
  19. package/commonjs/module/{module.f.cjs → module.f.mjs} +3 -5
  20. package/commonjs/module.f.mjs +11 -0
  21. package/commonjs/{module.cjs → module.mjs} +8 -6
  22. package/commonjs/package/dependencies/{module.f.cjs → module.f.mjs} +5 -5
  23. package/commonjs/package/dependencies/{test.f.cjs → test.f.mjs} +2 -2
  24. package/commonjs/package/{module.f.cjs → module.f.mjs} +7 -6
  25. package/commonjs/package/{test.f.cjs → test.f.mjs} +2 -2
  26. package/commonjs/path/{module.f.cjs → module.f.mjs} +15 -14
  27. package/commonjs/path/{test.f.cjs → test.f.mjs} +16 -14
  28. package/commonjs/{test.cjs → test.mjs} +4 -4
  29. package/dev/{module.f.cjs → module.f.mjs} +1 -1
  30. package/dev/module.mjs +5 -3
  31. package/dev/test/{module.f.cjs → module.f.mjs} +21 -9
  32. package/dev/{test.f.cjs → test.f.mjs} +1 -1
  33. package/dev/test.mjs +1 -1
  34. package/djs/{module.f.cjs → module.f.mjs} +18 -15
  35. package/djs/parser/{module.f.cjs → module.f.mjs} +29 -28
  36. package/djs/parser/{test.f.cjs → test.f.mjs} +10 -8
  37. package/djs/{test.f.cjs → test.f.mjs} +7 -5
  38. package/djs/tokenizer/{module.f.cjs → module.f.mjs} +19 -18
  39. package/djs/tokenizer/{test.f.cjs → test.f.mjs} +9 -7
  40. package/fsc/{module.f.cjs → module.f.mjs} +17 -16
  41. package/fsc/{test.f.cjs → test.f.mjs} +6 -4
  42. package/fsm/{module.f.cjs → module.f.mjs} +28 -24
  43. package/fsm/{test.f.cjs → test.f.mjs} +13 -9
  44. package/html/{module.f.cjs → module.f.mjs} +16 -13
  45. package/html/{test.f.cjs → test.f.mjs} +5 -5
  46. package/index.f.mjs +45 -35
  47. package/issues/README.md +15 -0
  48. package/js/tokenizer/{module.f.cjs → module.f.mjs} +52 -51
  49. package/js/tokenizer/{test.f.cjs → test.f.mjs} +9 -7
  50. package/json/{module.f.cjs → module.f.mjs} +18 -17
  51. package/json/parser/{module.f.cjs → module.f.mjs} +27 -26
  52. package/json/parser/{test.f.cjs → test.f.mjs} +10 -8
  53. package/json/serializer/{module.f.cjs → module.f.mjs} +12 -12
  54. package/json/serializer/{test.f.cjs → test.f.mjs} +4 -3
  55. package/json/{test.f.cjs → test.f.mjs} +6 -4
  56. package/json/tokenizer/{module.f.cjs → module.f.mjs} +16 -15
  57. package/json/tokenizer/{test.f.cjs → test.f.mjs} +9 -7
  58. package/jsr.json +1 -1
  59. package/nodejs/version/main.mjs +5 -0
  60. package/nodejs/version/{module.f.cjs → module.f.mjs} +2 -2
  61. package/nodejs/version/{test.f.cjs → test.f.mjs} +5 -5
  62. package/package.json +3 -3
  63. package/prime_field/{module.f.cjs → module.f.mjs} +6 -5
  64. package/prime_field/{test.f.cjs → test.f.mjs} +3 -2
  65. package/secp/{module.f.cjs → module.f.mjs} +7 -6
  66. package/secp/{test.f.cjs → test.f.mjs} +6 -6
  67. package/sha2/{module.f.cjs → module.f.mjs} +5 -5
  68. package/sha2/{test.f.cjs → test.f.mjs} +7 -6
  69. package/text/ascii/{module.f.cjs → module.f.mjs} +3 -3
  70. package/text/ascii/test.f.mjs +14 -0
  71. package/text/{module.f.cjs → module.f.mjs} +6 -6
  72. package/text/sgr/{module.f.cjs → module.f.mjs} +1 -1
  73. package/text/{test.f.cjs → test.f.mjs} +5 -4
  74. package/text/utf16/{module.f.cjs → module.f.mjs} +16 -14
  75. package/text/utf16/{test.f.cjs → test.f.mjs} +7 -6
  76. package/text/utf8/{module.f.cjs → module.f.mjs} +11 -11
  77. package/text/utf8/{test.f.cjs → test.f.mjs} +6 -5
  78. package/tsconfig.json +2 -2
  79. package/types/array/{module.f.cjs → module.f.mjs} +2 -2
  80. package/types/array/{test.f.cjs → test.f.mjs} +5 -4
  81. package/types/bigfloat/{module.f.cjs → module.f.mjs} +3 -3
  82. package/types/bigfloat/{test.f.cjs → test.f.mjs} +3 -2
  83. package/types/bigint/{module.f.cjs → module.f.mjs} +8 -7
  84. package/types/bigint/{test.f.cjs → test.f.mjs} +3 -2
  85. package/types/btree/find/{module.f.cjs → module.f.mjs} +12 -12
  86. package/types/btree/find/{test.f.cjs → test.f.mjs} +11 -9
  87. package/types/btree/{module.f.cjs → module.f.mjs} +7 -12
  88. package/types/btree/remove/{module.f.cjs → module.f.mjs} +17 -16
  89. package/types/btree/remove/{test.f.cjs → test.f.mjs} +9 -7
  90. package/types/btree/set/{module.f.cjs → module.f.mjs} +9 -9
  91. package/types/btree/set/{test.f.cjs → test.f.mjs} +8 -6
  92. package/types/btree/{test.f.cjs → test.f.mjs} +23 -20
  93. package/types/btree/types/{module.f.cjs → module.f.mjs} +1 -1
  94. package/types/byte_set/{module.f.cjs → module.f.mjs} +8 -7
  95. package/types/byte_set/{test.f.cjs → test.f.mjs} +8 -7
  96. package/types/function/compare/{module.f.cjs → module.f.mjs} +2 -2
  97. package/types/function/compare/{test.f.cjs → test.f.mjs} +3 -2
  98. package/types/function/{module.f.cjs → module.f.mjs} +1 -5
  99. package/types/function/operator/{module.f.cjs → module.f.mjs} +1 -1
  100. package/types/function/{test.f.cjs → test.f.mjs} +4 -2
  101. package/types/list/{module.f.cjs → module.f.mjs} +12 -12
  102. package/types/list/{test.f.cjs → test.f.mjs} +13 -11
  103. package/types/map/{module.f.cjs → module.f.mjs} +21 -18
  104. package/types/map/{test.f.cjs → test.f.mjs} +5 -4
  105. package/types/nibble_set/{module.f.cjs → module.f.mjs} +1 -1
  106. package/types/nibble_set/{test.f.cjs → test.f.mjs} +4 -3
  107. package/types/nullable/{module.f.cjs → module.f.mjs} +1 -1
  108. package/types/nullable/{test.f.cjs → test.f.mjs} +2 -2
  109. package/types/number/module.f.mjs +26 -0
  110. package/types/number/{test.f.cjs → test.f.mjs} +3 -2
  111. package/types/object/{module.f.cjs → module.f.mjs} +6 -6
  112. package/types/object/{test.f.cjs → test.f.mjs} +2 -2
  113. package/types/range/{module.f.cjs → module.f.mjs} +1 -1
  114. package/types/range/{test.f.cjs → test.f.mjs} +2 -2
  115. package/types/range_map/{module.f.cjs → module.f.mjs} +16 -15
  116. package/types/range_map/{test.f.cjs → test.f.mjs} +35 -33
  117. package/types/result/{module.f.cjs → module.f.mjs} +1 -1
  118. package/types/result/{module.cjs → module.mjs} +3 -3
  119. package/types/sorted_list/{module.f.cjs → module.f.mjs} +11 -10
  120. package/types/sorted_list/{test.f.cjs → test.f.mjs} +14 -10
  121. package/types/sorted_set/{module.f.cjs → module.f.mjs} +8 -7
  122. package/types/sorted_set/{test.f.cjs → test.f.mjs} +14 -10
  123. package/types/string/{module.f.cjs → module.f.mjs} +8 -7
  124. package/types/string/{test.f.cjs → test.f.mjs} +5 -3
  125. package/types/string_set/{module.f.cjs → module.f.mjs} +15 -10
  126. package/types/string_set/{test.f.cjs → test.f.mjs} +2 -2
  127. package/com/cpp/testlib.f.cjs +0 -6
  128. package/com/cs/testlib.f.cjs +0 -6
  129. package/com/module.f.cjs +0 -6
  130. package/com/rust/testlib.f.cjs +0 -6
  131. package/commonjs/module.f.cjs +0 -20
  132. package/nodejs/module.f.cjs +0 -4
  133. package/nodejs/version/main.cjs +0 -6
  134. package/text/ascii/test.f.cjs +0 -12
  135. package/types/number/module.f.cjs +0 -24
  136. package/types/object/test.html +0 -9
@@ -1,11 +1,12 @@
1
- const sortedList = require("../sorted_list/module.f.cjs")
1
+ import sortedList, * as SL from '../sorted_list/module.f.mjs'
2
2
  const { genericMerge } = sortedList
3
- const list = require("../list/module.f.cjs")
3
+ import list from '../list/module.f.mjs'
4
4
  const { next } = list
5
- const option = require("../nullable/module.f.cjs")
6
- const { cmp } = require('../number/module.f.cjs')
7
- const operator = require("../function/operator/module.f.cjs")
8
- const _range = require('../range/module.f.cjs')
5
+ import * as Option from '../nullable/module.f.mjs'
6
+ import number from '../number/module.f.mjs'
7
+ const { cmp } = number
8
+ import * as O from '../function/operator/module.f.mjs'
9
+ import _range, * as Range from '../range/module.f.mjs'
9
10
 
10
11
  /**
11
12
  * @template T
@@ -14,7 +15,7 @@ const _range = require('../range/module.f.cjs')
14
15
 
15
16
  /**
16
17
  * @template T
17
- * @typedef {sortedList.SortedList<Entry<T>>} RangeMap
18
+ * @typedef {SL.SortedList<Entry<T>>} RangeMap
18
19
  */
19
20
 
20
21
  /**
@@ -25,22 +26,22 @@ const _range = require('../range/module.f.cjs')
25
26
  /**
26
27
  * @template T
27
28
  * @typedef {{
28
- * readonly union: operator.Reduce<T>
29
- * readonly equal: operator.Equal<T>
29
+ * readonly union: O.Reduce<T>
30
+ * readonly equal: O.Equal<T>
30
31
  * }} Operators
31
32
  */
32
33
 
33
34
  /**
34
35
  * @template T
35
- * @typedef {option.Nullable<Entry<T>>} RangeState
36
+ * @typedef {Option.Nullable<Entry<T>>} RangeState
36
37
  */
37
38
 
38
39
  /**
39
40
  * @template T
40
- * @typedef {operator.Reduce<RangeMap<T>>} RangeMerge
41
+ * @typedef {O.Reduce<RangeMap<T>>} RangeMerge
41
42
  */
42
43
 
43
- /** @type {<T>(union: operator.Reduce<T>) => (equal: operator.Equal<T>) => sortedList.ReduceOp<Entry<T>, RangeState<T>>} */
44
+ /** @type {<T>(union: O.Reduce<T>) => (equal: O.Equal<T>) => SL.ReduceOp<Entry<T>, RangeState<T>>} */
44
45
  const reduceOp = union => equal => state => ([aItem, aMax]) => ([bItem, bMax]) => {
45
46
  const sign = cmp(aMax)(bMax)
46
47
  const min = sign === 1 ? bMax : aMax
@@ -49,7 +50,7 @@ const reduceOp = union => equal => state => ([aItem, aMax]) => ([bItem, bMax]) =
49
50
  return [newState, sign, [u, min]]
50
51
  }
51
52
 
52
- /** @type {<T>(equal: operator.Equal<T>) => sortedList.TailReduce<Entry<T>, RangeState<T>>} */
53
+ /** @type {<T>(equal: O.Equal<T>) => SL.TailReduce<Entry<T>, RangeState<T>>} */
53
54
  const tailReduce = equal => state => tail => {
54
55
  if (state === null) { return tail }
55
56
  const tailResult = next(tail)
@@ -78,10 +79,10 @@ const get = def => value => rm => {
78
79
  }
79
80
  }
80
81
 
81
- /** @type {<T>(def: T) => (r: _range.Range) => (value: T) => RangeMapArray<T>} */
82
+ /** @type {<T>(def: T) => (r: Range.Range) => (value: T) => RangeMapArray<T>} */
82
83
  const fromRange = def => ([a, b]) => v => [[def, a - 1], [v, b]]
83
84
 
84
- module.exports = {
85
+ export default {
85
86
  /** @readonly */
86
87
  merge,
87
88
  /** @readonly */
@@ -1,77 +1,79 @@
1
- const _ = require('./module.f.cjs')
2
- const { unsafeCmp } = require('../function/compare/module.f.cjs')
3
- const json = require('../../json/module.f.cjs')
4
- const { sort } = require('../../types/object/module.f.cjs')
5
- const sortedSet = require('../sorted_set/module.f.cjs')
6
- const list = require('../list/module.f.cjs')
7
- const operator = require("../function/operator/module.f.cjs")
1
+ import _, * as T from './module.f.mjs'
2
+ import compare from '../function/compare/module.f.mjs'
3
+ const { unsafeCmp } = compare
4
+ import json, * as jsonT from '../../json/module.f.mjs'
5
+ import object from '../object/module.f.mjs'
6
+ const { sort } = object
7
+ import sortedSet, * as SortedSet from '../sorted_set/module.f.mjs'
8
+ import list from '../list/module.f.mjs'
9
+ import operator from '../function/operator/module.f.mjs'
8
10
 
9
- /** @type {(a: readonly json.Unknown[]) => string} */
11
+ /** @type {(a: readonly jsonT.Unknown[]) => string} */
10
12
  const stringify = json.stringify(sort)
11
13
 
12
- /** @type {_.Operators<sortedSet.SortedSet<string>>} */
14
+ /** @type {T.Operators<SortedSet.SortedSet<string>>} */
13
15
  const op = { union: sortedSet.union(unsafeCmp), equal: list.equal(operator.strictEqual) }
14
16
 
15
- module.exports = {
17
+ export default {
16
18
  merge: [
17
19
  () => {
18
- /** @type {_.RangeMap<sortedSet.SortedSet<string>>} */
20
+ /** @type {T.RangeMap<SortedSet.SortedSet<string>>} */
19
21
  const a = [[['a'], 1], [['b'], 2]]
20
- /** @type {_.RangeMap<sortedSet.SortedSet<string>>} */
22
+ /** @type {T.RangeMap<SortedSet.SortedSet<string>>} */
21
23
  const b = null
22
24
  const merged = _.merge(op)(a)(b)
23
25
  const result = stringify(list.toArray(merged))
24
26
  if (result !== '[[["a"],1],[["b"],2]]') { throw result }
25
27
  },
26
28
  () => {
27
- /** @type {_.RangeMap<sortedSet.SortedSet<string>>} */
29
+ /** @type {T.RangeMap<SortedSet.SortedSet<string>>} */
28
30
  const a = null
29
- /** @type {_.RangeMap<sortedSet.SortedSet<string>>} */
31
+ /** @type {T.RangeMap<SortedSet.SortedSet<string>>} */
30
32
  const b = [[['a'], 1], [['b'], 2]]
31
33
  const merged = _.merge(op)(a)(b)
32
34
  const result = stringify(list.toArray(merged))
33
35
  if (result !== '[[["a"],1],[["b"],2]]') { throw result }
34
36
  },
35
37
  () => {
36
- /** @type {_.RangeMap<sortedSet.SortedSet<string>>} */
38
+ /** @type {T.RangeMap<SortedSet.SortedSet<string>>} */
37
39
  const a = [[['a'], 1], [['b'], 2]]
38
- /** @type {_.RangeMap<sortedSet.SortedSet<string>>} */
40
+ /** @type {T.RangeMap<SortedSet.SortedSet<string>>} */
39
41
  const b = [[['a'], 1], [['b'], 2]]
40
42
  const merged = _.merge(op)(a)(b)
41
43
  const result = stringify(list.toArray(merged))
42
44
  if (result !== '[[["a"],1],[["b"],2]]') { throw result }
43
45
  },
44
46
  () => {
45
- /** @type {_.RangeMap<sortedSet.SortedSet<string>>} */
47
+ /** @type {T.RangeMap<SortedSet.SortedSet<string>>} */
46
48
  const a = [[['a'], 1], [['c'], 3]]
47
- /** @type {_.RangeMap<sortedSet.SortedSet<string>>} */
49
+ /** @type {T.RangeMap<SortedSet.SortedSet<string>>} */
48
50
  const b = [[['b'], 2], [['d'], 4]]
49
51
  const merged = _.merge(op)(a)(b)
50
52
  const result = stringify(list.toArray(merged))
51
53
  if (result !== '[[["a","b"],1],[["b","c"],2],[["c","d"],3],[["d"],4]]') { throw result }
52
54
  },
53
55
  () => {
54
- /** @type {_.RangeMap<sortedSet.SortedSet<string>>} */
56
+ /** @type {T.RangeMap<SortedSet.SortedSet<string>>} */
55
57
  const a = [[['a'], 1], [['d'], 4]]
56
- /** @type {_.RangeMap<sortedSet.SortedSet<string>>} */
58
+ /** @type {T.RangeMap<SortedSet.SortedSet<string>>} */
57
59
  const b = [[['b'], 2], [['c'], 3]]
58
60
  const merged = _.merge(op)(a)(b)
59
61
  const result = stringify(list.toArray(merged))
60
62
  if (result !== '[[["a","b"],1],[["b","d"],2],[["c","d"],3],[["d"],4]]') { throw result }
61
63
  },
62
64
  () => {
63
- /** @type {_.RangeMap<sortedSet.SortedSet<string>>} */
65
+ /** @type {T.RangeMap<SortedSet.SortedSet<string>>} */
64
66
  const a = [[['a'], 1], [['b'], 2]]
65
- /** @type {_.RangeMap<sortedSet.SortedSet<string>>} */
67
+ /** @type {T.RangeMap<SortedSet.SortedSet<string>>} */
66
68
  const b = [[['b'], 1], [['a'], 2]]
67
69
  const merged = _.merge(op)(a)(b)
68
70
  const result = stringify(list.toArray(merged))
69
71
  if (result !== '[[["a","b"],2]]') { throw result }
70
72
  },
71
73
  () => {
72
- /** @type {_.RangeMap<sortedSet.SortedSet<string>>} */
74
+ /** @type {T.RangeMap<SortedSet.SortedSet<string>>} */
73
75
  const a = [[['a'], 1], [['b'], 2], [['a'], 3]]
74
- /** @type {_.RangeMap<sortedSet.SortedSet<string>>} */
76
+ /** @type {T.RangeMap<SortedSet.SortedSet<string>>} */
75
77
  const b = [[['a'], 5]]
76
78
  const merged = _.merge(op)(a)(b)
77
79
  const result = stringify(list.toArray(merged))
@@ -79,54 +81,54 @@ module.exports = {
79
81
  }
80
82
  ],
81
83
  get: () => {
82
- /** @type {sortedSet.SortedSet<string>} */
84
+ /** @type {SortedSet.SortedSet<string>} */
83
85
  const sortedSetEmpty = []
84
86
  const get = _.get(sortedSetEmpty)
85
87
  return [
86
88
  () => {
87
- /** @type {_.RangeMapArray<sortedSet.SortedSet<string>>} */
89
+ /** @type {T.RangeMapArray<SortedSet.SortedSet<string>>} */
88
90
  const rm = [[['a'], 10], [['b'], 20], [['c'], 30]]
89
91
  const result = stringify(get(5)(rm))
90
92
  if (result !== '["a"]') { throw result }
91
93
  },
92
94
  () => {
93
- /** @type {_.RangeMapArray<sortedSet.SortedSet<string>>} */
95
+ /** @type {T.RangeMapArray<SortedSet.SortedSet<string>>} */
94
96
  const rm = [[['a'], 10], [['b'], 20], [['c'], 30]]
95
97
  const result = stringify(get(10)(rm))
96
98
  if (result !== '["a"]') { throw result }
97
99
  },
98
100
  () => {
99
- /** @type {_.RangeMapArray<sortedSet.SortedSet<string>>} */
101
+ /** @type {T.RangeMapArray<SortedSet.SortedSet<string>>} */
100
102
  const rm = [[['a'], 10], [['b'], 20], [['c'], 30]]
101
103
  const result = stringify(get(15)(rm))
102
104
  if (result !== '["b"]') { throw result }
103
105
  },
104
106
  () => {
105
- /** @type {_.RangeMapArray<sortedSet.SortedSet<string>>} */
107
+ /** @type {T.RangeMapArray<SortedSet.SortedSet<string>>} */
106
108
  const rm = [[['a'], 10], [['b'], 20], [['c'], 30]]
107
109
  const result = stringify(get(20)(rm))
108
110
  if (result !== '["b"]') { throw result }
109
111
  },
110
112
  () => {
111
- /** @type {_.RangeMapArray<sortedSet.SortedSet<string>>} */
113
+ /** @type {T.RangeMapArray<SortedSet.SortedSet<string>>} */
112
114
  const rm = [[['a'], 10], [['b'], 20], [['c'], 30]]
113
115
  const result = stringify(get(25)(rm))
114
116
  if (result !== '["c"]') { throw result }
115
117
  },
116
118
  () => {
117
- /** @type {_.RangeMapArray<sortedSet.SortedSet<string>>} */
119
+ /** @type {T.RangeMapArray<SortedSet.SortedSet<string>>} */
118
120
  const rm = [[['a'], 10], [['b'], 20], [['c'], 30]]
119
121
  const result = stringify(get(30)(rm))
120
122
  if (result !== '["c"]') { throw result }
121
123
  },
122
124
  () => {
123
- /** @type {_.RangeMapArray<sortedSet.SortedSet<string>>} */
125
+ /** @type {T.RangeMapArray<SortedSet.SortedSet<string>>} */
124
126
  const rm = [[['a'], 10], [['b'], 20], [['c'], 30]]
125
127
  const result = stringify(get(35)(rm))
126
128
  if (result !== '[]') { throw result }
127
129
  },
128
130
  () => {
129
- /** @type {_.RangeMapArray<sortedSet.SortedSet<string>>} */
131
+ /** @type {T.RangeMapArray<SortedSet.SortedSet<string>>} */
130
132
  const rm = []
131
133
  const result = stringify(get(10)(rm))
132
134
  if (result !== '[]') { throw result }
@@ -26,7 +26,7 @@ const unwrap = ([kind, v]) => {
26
26
  return v
27
27
  }
28
28
 
29
- module.exports = {
29
+ export default {
30
30
  /** @readonly */
31
31
  ok,
32
32
  /** @readonly */
@@ -1,7 +1,7 @@
1
- const result = require('./module.f.cjs')
1
+ import result, * as Result from './module.f.mjs'
2
2
  const { ok, error } = result
3
3
 
4
- /** @type {<T>(f: () => T) => result.Result<T, unknown>} */
4
+ /** @type {<T>(f: () => T) => Result.Result<T, unknown>} */
5
5
  const tryCatch = f => {
6
6
  // Side effect: `try catch` is not allowed in FunctionalScript.
7
7
  try {
@@ -11,7 +11,7 @@ const tryCatch = f => {
11
11
  }
12
12
  }
13
13
 
14
- module.exports = {
14
+ export default {
15
15
  /** @readonly */
16
16
  tryCatch,
17
17
  }
@@ -1,12 +1,13 @@
1
- const compare = require('../function/compare/module.f.cjs')
2
- const list = require('../list/module.f.cjs')
3
- const option = require('../nullable/module.f.cjs')
1
+ import * as compare from '../function/compare/module.f.mjs'
2
+ import list, * as List from '../list/module.f.mjs'
3
+ import * as option from '../nullable/module.f.mjs'
4
4
  const { next } = list
5
- const { identity } = require('../function/module.f.cjs')
5
+ import f from '../function/module.f.mjs'
6
+ const { identity } = f
6
7
 
7
8
  /**
8
9
  * @template T
9
- * @typedef {list.List<T>} SortedList
10
+ * @typedef {List.List<T>} SortedList
10
11
  */
11
12
 
12
13
  /**
@@ -28,7 +29,7 @@ const { identity } = require('../function/module.f.cjs')
28
29
  /**
29
30
  * @template T
30
31
  * @template S
31
- * @typedef {(state: S) => (tail: list.List<T>) => list.List<T>} TailReduce
32
+ * @typedef {(state: S) => (tail: List.List<T>) => List.List<T>} TailReduce
32
33
  */
33
34
 
34
35
  /**
@@ -40,12 +41,12 @@ const { identity } = require('../function/module.f.cjs')
40
41
  * }} MergeReduce
41
42
  */
42
43
 
43
- /** @type {<T,S>(reduce: MergeReduce<T,S>) => (state: S) => (a: list.List<T>) => (b: list.List<T>) => list.List<T>} */
44
+ /** @type {<T,S>(reduce: MergeReduce<T,S>) => (state: S) => (a: List.List<T>) => (b: List.List<T>) => List.List<T>} */
44
45
  const genericMerge = ({ reduceOp, tailReduce }) => {
45
46
  /** @typedef {typeof reduceOp extends ReduceOp<infer T, infer S> ? [T, S] : never} TS */
46
47
  /** @typedef {TS[0]} T */
47
48
  /** @typedef {TS[1]} S */
48
- /** @type {(state: S) => (a: list.List<T>) => (b: list.List<T>) => list.List<T>} */
49
+ /** @type {(state: S) => (a: List.List<T>) => (b: List.List<T>) => List.List<T>} */
49
50
  const f = state => a => b => () => {
50
51
  const aResult = next(a)
51
52
  if (aResult === null) { return tailReduce(state)(b) }
@@ -79,7 +80,7 @@ const cmpReduce = cmp => () => a => b => {
79
80
  return [sign === 1 ? b : a, sign, null]
80
81
  }
81
82
 
82
- /** @type {() => <T>(tail: list.List<T>) => list.List<T>} */
83
+ /** @type {() => <T>(tail: List.List<T>) => List.List<T>} */
83
84
  const mergeTail = () => identity
84
85
 
85
86
  /** @type {<T>(cmp: Cmp<T>) => (value: T) => (array: SortedArray<T>) => T|null} */
@@ -104,7 +105,7 @@ const find = cmp => value => array => {
104
105
  }
105
106
  }
106
107
 
107
- module.exports = {
108
+ export default {
108
109
  /** @readonly */
109
110
  merge,
110
111
  /** @readonly */
@@ -1,18 +1,22 @@
1
- const _ = require('./module.f.cjs')
2
- const { unsafeCmp } = require('../function/compare/module.f.cjs')
3
- const json = require('../../json/module.f.cjs')
4
- const { sort } = require('../../types/object/module.f.cjs')
5
- const { toArray, countdown, length } = require('../list/module.f.cjs')
6
- const map = require('../map/module.f.cjs')
7
- const { flip } = require('../function/module.f.cjs')
1
+ import _ from './module.f.mjs'
2
+ import compare from '../function/compare/module.f.mjs'
3
+ const { unsafeCmp } = compare
4
+ import json, * as Json from '../../json/module.f.mjs'
5
+ import object from '../object/module.f.mjs'
6
+ const { sort } = object
7
+ import list from '../list/module.f.mjs'
8
+ const { toArray, countdown, length } = list
9
+ import map, * as Map from '../map/module.f.mjs'
10
+ import f from '../function/module.f.mjs'
11
+ const { flip } = f
8
12
 
9
- /** @type {(a: readonly json.Unknown[]) => string} */
13
+ /** @type {(a: readonly Json.Unknown[]) => string} */
10
14
  const stringify = a => json.stringify(sort)(a)
11
15
 
12
- /** @type {<T>(a: T) => (b: T) => map.Sign} */
16
+ /** @type {<T>(a: T) => (b: T) => Map.Sign} */
13
17
  const reverseCmp = flip(unsafeCmp)
14
18
 
15
- module.exports = {
19
+ export default {
16
20
  sortedMergre: [
17
21
  () => {
18
22
  const result = stringify(toArray(_.merge(unsafeCmp)([2, 3, 4])([1, 3, 5])))
@@ -1,6 +1,7 @@
1
- const compare = require("../function/compare/module.f.cjs")
2
- const { toArray } = require("../list/module.f.cjs")
3
- const sortedList = require("../sorted_list/module.f.cjs")
1
+ import * as Compare from '../function/compare/module.f.mjs'
2
+ import list from "../list/module.f.mjs"
3
+ const { toArray } = list
4
+ import sortedList, * as SortedList from '../sorted_list/module.f.mjs'
4
5
  const { merge, genericMerge, find } = sortedList
5
6
 
6
7
  /**
@@ -10,7 +11,7 @@ const { merge, genericMerge, find } = sortedList
10
11
 
11
12
  /**
12
13
  * @template T
13
- * @typedef {(a: T) => (b: T) => compare.Sign} Cmp
14
+ * @typedef {(a: T) => (b: T) => Compare.Sign} Cmp
14
15
  */
15
16
 
16
17
  /** @typedef {number} Byte */
@@ -23,10 +24,10 @@ const intersect = cmp => a => b => toArray(intersectMerge(cmp)(a)(b))
23
24
 
24
25
  const tailReduce = () => () => null
25
26
 
26
- /** @type {<T>(cmp: Cmp<T>) => (a: sortedList.SortedList<T>) => (b: sortedList.SortedList<T>) => sortedList.SortedList<T>} */
27
+ /** @type {<T>(cmp: Cmp<T>) => (a: SortedList.SortedList<T>) => (b: SortedList.SortedList<T>) => SortedList.SortedList<T>} */
27
28
  const intersectMerge = cmp => genericMerge({ reduceOp: intersectReduce(cmp), tailReduce })(null)
28
29
 
29
- /** @type {<T,S>(cmp: Cmp<T>) => sortedList.ReduceOp<T,S>} */
30
+ /** @type {<T,S>(cmp: Cmp<T>) => SortedList.ReduceOp<T,S>} */
30
31
  const intersectReduce = cmp => state => a => b => {
31
32
  const sign = cmp(a)(b)
32
33
  return [sign === 0 ? a : null, sign, state]
@@ -35,7 +36,7 @@ const intersectReduce = cmp => state => a => b => {
35
36
  /** @type {<T>(cmp: Cmp<T>) => (value: T) => (set: SortedSet<T>) => boolean} */
36
37
  const has = cmp => value => set => find(cmp)(value)(set) === value
37
38
 
38
- module.exports = {
39
+ export default {
39
40
  /** @readonly */
40
41
  union,
41
42
  /** @readonly */
@@ -1,18 +1,22 @@
1
- const _ = require('./module.f.cjs')
2
- const { unsafeCmp } = require('../function/compare/module.f.cjs')
3
- const json = require('../../json/module.f.cjs')
4
- const { sort } = require('../../types/object/module.f.cjs')
5
- const { toArray, countdown, length } = require('../list/module.f.cjs')
6
- const map = require('../map/module.f.cjs')
7
- const { flip } = require('../function/module.f.cjs')
1
+ import _ from './module.f.mjs'
2
+ import compare from '../function/compare/module.f.mjs'
3
+ const { unsafeCmp } = compare
4
+ import json, * as Json from '../../json/module.f.mjs'
5
+ import object from '../object/module.f.mjs'
6
+ const { sort } = object
7
+ import list from '../list/module.f.mjs'
8
+ const { toArray, countdown, length } = list
9
+ import map, * as Map from '../map/module.f.mjs'
10
+ import f from '../function/module.f.mjs'
11
+ const { flip } = f
8
12
 
9
- /** @type {(a: readonly json.Unknown[]) => string} */
13
+ /** @type {(a: readonly Json.Unknown[]) => string} */
10
14
  const stringify = a => json.stringify(sort)(a)
11
15
 
12
- /** @type {<T>(a: T) => (b: T) => map.Sign} */
16
+ /** @type {<T>(a: T) => (b: T) => Map.Sign} */
13
17
  const reverseCmp = flip(unsafeCmp)
14
18
 
15
- module.exports = {
19
+ export default {
16
20
  union: [
17
21
  () => {
18
22
  const result = stringify(toArray(_.union(unsafeCmp)([2, 3, 4])([1, 3, 5])))
@@ -1,12 +1,13 @@
1
- const list = require('../list/module.f.cjs')
1
+ import list, * as List from '../list/module.f.mjs'
2
2
  const { reduce: listReduce, repeat: listRepeat } = list
3
- const { compose } = require('../function/module.f.cjs')
4
- const compare = require('../function/compare/module.f.cjs')
3
+ import f from '../function/module.f.mjs'
4
+ const { compose } = f
5
+ import compare, * as Compare from '../function/compare/module.f.mjs'
5
6
  const { unsafeCmp } = compare
6
- const op = require('../function/operator/module.f.cjs')
7
+ import op, * as Op from '../function/operator/module.f.mjs'
7
8
  const { join: joinOp, concat: concatOp } = op
8
9
 
9
- /** @type {(o: op.Reduce<string>) => (input: list.List<string>) => string} */
10
+ /** @type {(o: Op.Reduce<string>) => (input: List.List<string>) => string} */
10
11
  const reduce = o => listReduce(o)('')
11
12
 
12
13
  const join = compose(joinOp)(reduce)
@@ -16,10 +17,10 @@ const concat = reduce(concatOp)
16
17
  /** @type {(n: string) => (v: number) => string} */
17
18
  const repeat = v => compose(listRepeat(v))(concat)
18
19
 
19
- /** @type {(a: string) => (b: string) => compare.Sign} */
20
+ /** @type {(a: string) => (b: string) => Compare.Sign} */
20
21
  const cmp = unsafeCmp
21
22
 
22
- module.exports = {
23
+ export default {
23
24
  /** @readonly */
24
25
  join,
25
26
  /** @readonly */
@@ -1,7 +1,9 @@
1
- const { join, concat, repeat, cmp } = require('./module.f.cjs')
2
- const { repeat: repeatList } = require('../list/module.f.cjs')
1
+ import _ from './module.f.mjs'
2
+ const { join, concat, repeat, cmp } = _
3
+ import list from '../list/module.f.mjs'
4
+ const { repeat: repeatList } = list
3
5
 
4
- module.exports = {
6
+ export default {
5
7
  join: {
6
8
  0: () => {
7
9
  const result = join('/')([])
@@ -1,19 +1,24 @@
1
- const btTypes = require('../btree/types/module.f.cjs')
2
- const btree = require('../btree/module.f.cjs')
1
+ import * as BtreeTypes from '../btree/types/module.f.mjs'
2
+ import btree from '../btree/module.f.mjs'
3
+ import btf from '../btree/find/module.f.mjs'
4
+ const { find, isFound } = btf
5
+ import btr from '../btree/remove/module.f.mjs'
6
+ const { remove: btreeRemove } = btr
7
+ import bts from '../btree/set/module.f.mjs'
8
+ const { set: btreeSet } = bts
3
9
  const {
4
- find: { find, isFound },
5
- remove: { remove: btreeRemove },
6
- set: { set: btreeSet },
7
10
  /** @type {(s: StringSet) => list.List<string>} */
8
11
  values,
9
12
  empty,
10
13
  } = btree
11
- const { cmp } = require("../string/module.f.cjs")
12
- const list = require('../list/module.f.cjs')
14
+ import string from "../string/module.f.mjs"
15
+ const { cmp } = string
16
+ import list from '../list/module.f.mjs'
13
17
  const { fold } = list
14
- const { compose } = require('../function/module.f.cjs')
18
+ import f from '../function/module.f.mjs'
19
+ const { compose } = f
15
20
 
16
- /** @typedef {btTypes.Tree<string>} StringSet */
21
+ /** @typedef {BtreeTypes.Tree<string>} StringSet */
17
22
 
18
23
  /** @type {(value: string) => (set: StringSet) => boolean} */
19
24
  const contains = value => {
@@ -29,7 +34,7 @@ const fromValues = fold(set)(null)
29
34
  /** @type {(value: string) => (s: StringSet) => StringSet} */
30
35
  const remove = compose(cmp)(btreeRemove)
31
36
 
32
- module.exports = {
37
+ export default {
33
38
  /** @readonly */
34
39
  empty,
35
40
  /** @readonly */
@@ -1,6 +1,6 @@
1
- const _ = require('./module.f.cjs')
1
+ import _ from './module.f.mjs'
2
2
 
3
- module.exports = {
3
+ export default {
4
4
  contains: () => {
5
5
  const r = _.set('hello')(null)
6
6
  if (!_.contains('hello')(r)) { throw r }
@@ -1,6 +0,0 @@
1
- const { join } = require("../../types/string/module.f.cjs");
2
- const { flat } = require("../../text/module.f.cjs")
3
- const library = require('../types/testlib.f.cjs')
4
- const { cpp } = require('./module.f.cjs')
5
-
6
- module.exports = () => join('\n')(flat(' ')(cpp('My')(library)))
@@ -1,6 +0,0 @@
1
- const { flat } = require('../../text/module.f.cjs');
2
- const { join } = require('../../types/string/module.f.cjs');
3
- const { cs } = require('./module.f.cjs');
4
- const library = require('../types/testlib.f.cjs')
5
-
6
- module.exports = join('\n')(flat(' ')(cs('My')(library)))
package/com/module.f.cjs DELETED
@@ -1,6 +0,0 @@
1
- const types = require('./types/module.f.cjs');
2
-
3
- module.exports = {
4
- /** @readonly */
5
- types,
6
- }
@@ -1,6 +0,0 @@
1
- const { flat } = require('../../text/module.f.cjs');
2
- const { join } = require('../../types/string/module.f.cjs');
3
- const { rust } = require('./module.f.cjs');
4
- const library = require('../types/testlib.f.cjs')
5
-
6
- module.exports = join('\n')(flat(' ')(rust(library)))
@@ -1,20 +0,0 @@
1
- /** @typedef {(packageName: string) => PackageMap|Package|null} PackageMap */
2
-
3
- /**
4
- * @typedef {readonly[
5
- * string,
6
- * PackageMap,
7
- * (fileName: string) => string|null
8
- * ]} Package
9
- */
10
-
11
- module.exports = {
12
- /** @readonly */
13
- build: require('./build/module.f.cjs'),
14
- /** @readonly */
15
- module: require('./module/module.f.cjs'),
16
- /** @readonly */
17
- package: require('./package/module.f.cjs'),
18
- /** @readonly */
19
- path: require('./path/module.f.cjs'),
20
- }
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- /** @readonly */
3
- version: require('./version/module.f.cjs')
4
- }
@@ -1,6 +0,0 @@
1
- const { version } = require('./module.f.cjs')
2
-
3
- const child_process = require('node:child_process')
4
- const fs = require('node:fs')
5
-
6
- version({ child_process, fs })
@@ -1,12 +0,0 @@
1
- const { range } = require('./module.f.cjs')
2
- const json = require('../../json/module.f.cjs')
3
- const { sort } = require('../../types/object/module.f.cjs')
4
-
5
- const stringify = json.stringify(sort)
6
-
7
- module.exports = {
8
- range: () => {
9
- const r = stringify(range("A"))
10
- if (r !== '[65,65]') { throw r }
11
- }
12
- }