functionalscript 0.3.7 → 0.3.9

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 (123) 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 +1 -1
  20. package/crypto/prime_field/module.f.js +1 -1
  21. package/crypto/secp/module.f.d.ts +1 -1
  22. package/crypto/secp/module.f.js +2 -2
  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/js/tokenizer/module.f.d.ts +1 -1
  39. package/js/tokenizer/module.f.js +1 -1
  40. package/json/parser/module.f.d.ts +2 -2
  41. package/json/parser/module.f.js +0 -3
  42. package/json/serializer/module.f.js +0 -2
  43. package/json/tokenizer/module.f.js +0 -1
  44. package/package.json +1 -1
  45. package/text/ascii/module.f.d.ts +1 -1
  46. package/text/ascii/module.f.js +2 -3
  47. package/text/ascii/test.f.js +2 -4
  48. package/text/module.f.d.ts +18 -3
  49. package/text/module.f.js +22 -6
  50. package/text/sgr/module.f.js +1 -1
  51. package/text/test.f.d.ts +4 -1
  52. package/text/test.f.js +24 -16
  53. package/text/utf16/module.f.d.ts +5 -6
  54. package/text/utf16/module.f.js +9 -10
  55. package/text/utf16/test.f.js +29 -30
  56. package/text/utf8/module.f.d.ts +8 -5
  57. package/text/utf8/module.f.js +3 -5
  58. package/text/utf8/test.f.js +34 -35
  59. package/types/bigfloat/module.f.js +1 -1
  60. package/types/bigint/module.f.d.ts +36 -7
  61. package/types/bigint/module.f.js +40 -11
  62. package/types/bigint/test.f.d.ts +8 -0
  63. package/types/bigint/test.f.js +81 -2
  64. package/types/bit_vec/module.f.d.ts +103 -83
  65. package/types/bit_vec/module.f.js +68 -110
  66. package/types/bit_vec/test.f.d.ts +20 -8
  67. package/types/bit_vec/test.f.js +110 -117
  68. package/types/btree/find/module.f.d.ts +11 -10
  69. package/types/btree/find/module.f.js +1 -5
  70. package/types/btree/find/test.f.js +4 -6
  71. package/types/btree/module.f.d.ts +3 -3
  72. package/types/btree/module.f.js +2 -5
  73. package/types/btree/remove/module.f.d.ts +2 -2
  74. package/types/btree/remove/module.f.js +0 -3
  75. package/types/btree/remove/test.f.js +4 -7
  76. package/types/btree/set/module.f.d.ts +2 -2
  77. package/types/btree/set/module.f.js +2 -6
  78. package/types/btree/set/test.f.js +3 -6
  79. package/types/btree/test.f.js +9 -13
  80. package/types/btree/types/module.f.d.ts +1 -3
  81. package/types/byte_set/module.f.d.ts +3 -3
  82. package/types/byte_set/module.f.js +1 -4
  83. package/types/byte_set/test.f.js +2 -4
  84. package/types/function/compare/module.f.d.ts +1 -5
  85. package/types/function/compare/module.f.js +0 -1
  86. package/types/function/compare/test.f.js +1 -2
  87. package/types/function/module.f.d.ts +1 -1
  88. package/types/function/module.f.js +1 -1
  89. package/types/function/operator/module.f.d.ts +2 -3
  90. package/types/function/operator/module.f.js +5 -5
  91. package/types/function/test.f.js +1 -2
  92. package/types/list/module.f.d.ts +1 -1
  93. package/types/list/module.f.js +9 -9
  94. package/types/list/test.f.js +2 -4
  95. package/types/map/module.f.d.ts +7 -9
  96. package/types/map/module.f.js +6 -15
  97. package/types/map/test.f.js +3 -4
  98. package/types/nibble_set/module.f.d.ts +2 -3
  99. package/types/nibble_set/test.f.js +26 -27
  100. package/types/nullable/test.f.js +2 -2
  101. package/types/number/module.f.d.ts +2 -2
  102. package/types/number/module.f.js +1 -2
  103. package/types/number/test.f.js +1 -2
  104. package/types/object/module.f.d.ts +5 -5
  105. package/types/object/module.f.js +2 -4
  106. package/types/object/test.f.js +3 -3
  107. package/types/range/test.f.js +6 -6
  108. package/types/range_map/module.f.d.ts +8 -8
  109. package/types/range_map/module.f.js +3 -9
  110. package/types/range_map/test.f.js +2 -4
  111. package/types/result/module.f.d.ts +2 -3
  112. package/types/sorted_list/module.f.d.ts +8 -8
  113. package/types/sorted_list/module.f.js +2 -6
  114. package/types/sorted_list/test.f.js +12 -17
  115. package/types/sorted_set/module.f.d.ts +2 -2
  116. package/types/sorted_set/module.f.js +2 -5
  117. package/types/sorted_set/test.f.js +14 -19
  118. package/types/string/module.f.d.ts +5 -5
  119. package/types/string/module.f.js +2 -4
  120. package/types/string/test.f.js +2 -4
  121. package/types/string_set/module.f.d.ts +2 -2
  122. package/types/string_set/module.f.js +5 -11
  123. package/types/string_set/test.f.js +25 -25
@@ -1,17 +1,17 @@
1
1
  import { identity, fn, compose } from "../function/module.f.js";
2
2
  import { addition, logicalNot, strictEqual, stateScanToScan, foldToScan, reduceToScan, } from "../function/operator/module.f.js";
3
- const fromArray = array => {
4
- const at = i => i < array.length ? { first: array[i], tail: () => at(i + 1) } : null;
3
+ const fromArray = (array) => {
4
+ const at = (i) => i < array.length ? { first: array[i], tail: () => at(i + 1) } : null;
5
5
  return at(0);
6
6
  };
7
- export const concat = head => tail => tail === null ? head : ({ head, tail });
8
- const trampoline = list => {
7
+ export const concat = (head) => (tail) => tail === null ? head : ({ head, tail });
8
+ const trampoline = (list) => {
9
9
  while (typeof list === 'function') {
10
10
  list = list();
11
11
  }
12
12
  return list;
13
13
  };
14
- export const next = head => {
14
+ export const next = (head) => {
15
15
  let tail = null;
16
16
  while (true) {
17
17
  head = trampoline(head);
@@ -31,7 +31,7 @@ export const next = head => {
31
31
  [head, tail] = [tail, null];
32
32
  }
33
33
  };
34
- export const iterable = list => ({
34
+ export const iterable = (list) => ({
35
35
  *[Symbol.iterator]() {
36
36
  let i = list;
37
37
  while (true) {
@@ -45,11 +45,11 @@ export const iterable = list => ({
45
45
  }
46
46
  });
47
47
  const { from } = Array;
48
- export const toArray = list => {
48
+ export const toArray = (list) => {
49
49
  const u = trampoline(list);
50
50
  return u instanceof Array ? u : from(iterable(u));
51
51
  };
52
- const apply = f => input => () => {
52
+ const apply = (f) => (input) => () => {
53
53
  const n = next(input);
54
54
  if (n === null) {
55
55
  return null;
@@ -58,7 +58,7 @@ const apply = f => input => () => {
58
58
  };
59
59
  const flatStep = ({ first, tail }) => concat(first)(flat(tail));
60
60
  export const flat = apply(flatStep);
61
- const mapStep = f => ({ first, tail }) => ({ first: f(first), tail: map(f)(tail) });
61
+ const mapStep = (f) => ({ first, tail }) => ({ first: f(first), tail: map(f)(tail) });
62
62
  export const map = f => apply(mapStep(f));
63
63
  export const flatMap = f => compose(map(f))(flat);
64
64
  const filterStep = f => ({ first, tail }) => {
@@ -1,9 +1,7 @@
1
1
  import * as _ 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;
5
- import * as operator from "../function/operator/module.f.js";
6
- const { addition, strictEqual, reduceToScan } = operator;
3
+ import { sort } from "../object/module.f.js";
4
+ import { addition, strictEqual, reduceToScan } from "../function/operator/module.f.js";
7
5
  const stringify = sequence => json.stringify(sort)(_.toArray(sequence));
8
6
  const stringifyTest = () => {
9
7
  const s = stringify([1, 2, 3]);
@@ -1,14 +1,12 @@
1
- import * as BtreeTypes from '../btree/types/module.f.ts';
2
- import * as Compare from '../function/compare/module.f.ts';
3
- import * as list from '../list/module.f.ts';
4
- import * as Operator from '../function/operator/module.f.ts';
5
- export type Sign = Compare.Sign;
1
+ import type { Tree } from '../btree/types/module.f.ts';
2
+ import { type List } from '../list/module.f.ts';
3
+ import type { Reduce } from '../function/operator/module.f.ts';
6
4
  export type Entry<T> = readonly [string, T];
7
- export type Map<T> = BtreeTypes.Tree<Entry<T>>;
5
+ export type Map<T> = Tree<Entry<T>>;
8
6
  export declare const at: (name: string) => <T>(map: Map<T>) => T | null;
9
- export declare const setReduce: <T>(reduce: Operator.Reduce<T>) => (name: string) => (value: T) => (map: Map<T>) => Map<T>;
7
+ export declare const setReduce: <T>(reduce: Reduce<T>) => (name: string) => (value: T) => (map: Map<T>) => Map<T>;
10
8
  export declare const setReplace: (name: string) => <T>(value: T) => (map: Map<T>) => Map<T>;
11
- export declare const entries: <T>(map: Map<T>) => list.List<Entry<T>>;
12
- export declare const fromEntries: <T>(entries: list.List<Entry<T>>) => Map<T>;
9
+ export declare const entries: <T>(map: Map<T>) => List<Entry<T>>;
10
+ export declare const fromEntries: <T>(entries: List<Entry<T>>) => Map<T>;
13
11
  export declare const remove: (name: string) => <T>(map: Map<T>) => Map<T>;
14
12
  export declare const empty: null;
@@ -1,18 +1,9 @@
1
- import * as BtreeTypes from "../btree/types/module.f.js";
2
- import * as btf from "../btree/find/module.f.js";
3
- const { value, find } = btf;
4
- import * as bts from "../btree/set/module.f.js";
5
- const { set } = bts;
6
- import * as btr from "../btree/remove/module.f.js";
7
- const { remove: btreeRemove } = btr;
8
- import * as bt from "../btree/module.f.js";
9
- const { values } = bt;
10
- import * as Compare from "../function/compare/module.f.js";
11
- import * as s from "../string/module.f.js";
12
- const { cmp } = s;
13
- import * as list from "../list/module.f.js";
14
- const { fold } = list;
15
- import * as Operator from "../function/operator/module.f.js";
1
+ import { value, find } from "../btree/find/module.f.js";
2
+ import { set } from "../btree/set/module.f.js";
3
+ import { remove as btreeRemove } from "../btree/remove/module.f.js";
4
+ import { values } from "../btree/module.f.js";
5
+ import { cmp } from "../string/module.f.js";
6
+ import { fold } from "../list/module.f.js";
16
7
  const keyCmp = a => ([b]) => cmp(a)(b);
17
8
  export const at = (name) => (map) => {
18
9
  if (map === null) {
@@ -1,6 +1,5 @@
1
- import * as _ from "./module.f.js";
2
- const { at, setReplace, setReduce, empty, entries, remove } = _;
3
- import * as seq from "../list/module.f.js";
1
+ import { at, setReplace, setReduce, empty, entries, remove } from "./module.f.js";
2
+ import { toArray } from "../list/module.f.js";
4
3
  export default {
5
4
  main: [
6
5
  () => {
@@ -91,7 +90,7 @@ export default {
91
90
  if (at('a')(m) !== null) {
92
91
  throw 'error';
93
92
  }
94
- const e = seq.toArray(entries(m));
93
+ const e = toArray(entries(m));
95
94
  if (e.length !== 2) {
96
95
  throw 'error';
97
96
  }
@@ -1,5 +1,5 @@
1
- type NibbleSet = number;
2
- type Nibble = number;
1
+ export type NibbleSet = number;
2
+ export type Nibble = number;
3
3
  export declare const empty = 0;
4
4
  export declare const universe = 65535;
5
5
  export declare const has: (n: Nibble) => (s: NibbleSet) => boolean;
@@ -7,4 +7,3 @@ export declare const set: (n: Nibble) => (s: NibbleSet) => NibbleSet;
7
7
  export declare const complement: (n: NibbleSet) => NibbleSet;
8
8
  export declare const unset: (n: Nibble) => (s: NibbleSet) => NibbleSet;
9
9
  export declare const setRange: (r: readonly [number, number]) => (s: NibbleSet) => NibbleSet;
10
- export {};
@@ -1,88 +1,87 @@
1
- import * as list from "../list/module.f.js";
2
- const { every, map, countdown } = list;
3
- import * as _ from "./module.f.js";
1
+ import { every, map, countdown } from "../list/module.f.js";
2
+ import { empty, has, set, setRange, unset, universe, complement } from "./module.f.js";
4
3
  export default {
5
4
  has: () => {
6
- if (_.has(0)(_.empty)) {
7
- throw _.empty;
5
+ if (has(0)(empty)) {
6
+ throw empty;
8
7
  }
9
- if (_.has(1)(_.empty)) {
10
- throw _.empty;
8
+ if (has(1)(empty)) {
9
+ throw empty;
11
10
  }
12
- if (_.has(15)(_.empty)) {
13
- throw _.empty;
11
+ if (has(15)(empty)) {
12
+ throw empty;
14
13
  }
15
14
  },
16
15
  set: [
17
16
  () => {
18
- const s = _.set(0)(_.empty);
17
+ const s = set(0)(empty);
19
18
  if (s !== 1) {
20
19
  throw s;
21
20
  }
22
- if (!_.has(0)(s)) {
21
+ if (!has(0)(s)) {
23
22
  throw s;
24
23
  }
25
- if (_.has(1)(s)) {
24
+ if (has(1)(s)) {
26
25
  throw s;
27
26
  }
28
- if (_.has(15)(s)) {
27
+ if (has(15)(s)) {
29
28
  throw s;
30
29
  }
31
30
  },
32
31
  () => {
33
- const s = _.set(15)(_.empty);
32
+ const s = set(15)(empty);
34
33
  if (s !== 0x8000) {
35
34
  throw s;
36
35
  }
37
- if (_.has(0)(s)) {
36
+ if (has(0)(s)) {
38
37
  throw s;
39
38
  }
40
- if (_.has(1)(s)) {
39
+ if (has(1)(s)) {
41
40
  throw s;
42
41
  }
43
- if (!_.has(15)(s)) {
42
+ if (!has(15)(s)) {
44
43
  throw s;
45
44
  }
46
45
  }
47
46
  ],
48
47
  unset: () => [
49
48
  () => {
50
- const a = _.set(0)(_.empty);
51
- const result = _.unset(0)(a);
49
+ const a = set(0)(empty);
50
+ const result = unset(0)(a);
52
51
  if (result !== 0) {
53
52
  throw result;
54
53
  }
55
54
  },
56
55
  () => {
57
- const a = _.set(15)(_.empty);
58
- const result = _.unset(15)(a);
56
+ const a = set(15)(empty);
57
+ const result = unset(15)(a);
59
58
  if (result !== 0) {
60
59
  throw result;
61
60
  }
62
61
  }
63
62
  ],
64
63
  setRange: () => {
65
- const result = _.setRange([2, 5])(_.empty);
64
+ const result = setRange([2, 5])(empty);
66
65
  if (result !== 60) {
67
66
  throw result;
68
67
  }
69
68
  },
70
69
  universe: () => {
71
- const x = every(map((v) => _.has(v)(_.universe))(countdown(16)));
70
+ const x = every(map((v) => has(v)(universe))(countdown(16)));
72
71
  if (!x) {
73
72
  throw x;
74
73
  }
75
74
  },
76
75
  compliment: {
77
76
  empty: () => {
78
- const r = _.complement(_.empty);
79
- if (r !== _.universe) {
77
+ const r = complement(empty);
78
+ if (r !== universe) {
80
79
  throw r;
81
80
  }
82
81
  },
83
82
  universe: () => {
84
- const r = _.complement(_.universe);
85
- if (r !== _.empty) {
83
+ const r = complement(universe);
84
+ if (r !== empty) {
86
85
  throw r;
87
86
  }
88
87
  },
@@ -1,6 +1,6 @@
1
- import * as _ from "./module.f.js";
1
+ import { map } from "./module.f.js";
2
2
  export default () => {
3
- const optionSq = _.map((v) => v * v);
3
+ const optionSq = map((v) => v * v);
4
4
  const sq3 = optionSq(3);
5
5
  if (sq3 !== 9) {
6
6
  throw sq3;
@@ -1,6 +1,6 @@
1
1
  import { type List } from '../list/module.f.ts';
2
- import * as compare from '../function/compare/module.f.ts';
2
+ import { type Sign } from '../function/compare/module.f.ts';
3
3
  export declare const sum: (input: List<number>) => number;
4
4
  export declare const min: (input: List<number>) => number | null;
5
5
  export declare const max: (input: List<number>) => number | null;
6
- export declare const cmp: (a: number) => (b: number) => compare.Sign;
6
+ export declare const cmp: (a: number) => (b: number) => Sign;
@@ -1,7 +1,6 @@
1
1
  import { reduce } from "../list/module.f.js";
2
2
  import { addition, min as minOp, max as maxOp } from "../function/operator/module.f.js";
3
- import * as compare from "../function/compare/module.f.js";
4
- const { unsafeCmp } = compare;
3
+ import { unsafeCmp } from "../function/compare/module.f.js";
5
4
  export const sum = reduce(addition)(0);
6
5
  export const min = reduce(minOp)(null);
7
6
  export const max = reduce(maxOp)(null);
@@ -1,5 +1,4 @@
1
- import * as _ from "./module.f.js";
2
- const { sum, min, max, cmp } = _;
1
+ import { sum, min, max, cmp } from "./module.f.js";
3
2
  export default {
4
3
  sum: () => {
5
4
  const result = sum([2, 3, 4, 5]);
@@ -1,10 +1,10 @@
1
- import * as list from '../list/module.f.ts';
2
- import * as btMap from '../map/module.f.ts';
1
+ import { type List } from '../list/module.f.ts';
2
+ import { type Map as BtMap } from '../map/module.f.ts';
3
3
  export type Map<T> = {
4
4
  readonly [k in string]: T;
5
5
  };
6
6
  export type Entry<T> = readonly [string, T];
7
7
  export declare const at: (name: string) => <T>(object: Map<T>) => T | null;
8
- export declare const sort: <T>(e: list.List<Entry<T>>) => list.List<Entry<T>>;
9
- export declare const fromEntries: <T>(e: list.List<Entry<T>>) => Map<T>;
10
- export declare const fromMap: <T>(m: btMap.Map<T>) => Map<T>;
8
+ export declare const sort: <T>(e: List<Entry<T>>) => List<Entry<T>>;
9
+ export declare const fromEntries: <T>(e: List<Entry<T>>) => Map<T>;
10
+ export declare const fromMap: <T>(m: BtMap<T>) => Map<T>;
@@ -1,7 +1,5 @@
1
- import * as list from "../list/module.f.js";
2
- const { iterable } = list;
3
- import * as btMap from "../map/module.f.js";
4
- const { entries: mapEntries, fromEntries: mapFromEntries } = btMap;
1
+ import { iterable } from "../list/module.f.js";
2
+ import { entries as mapEntries, fromEntries as mapFromEntries } from "../map/module.f.js";
5
3
  const { getOwnPropertyDescriptor, fromEntries: objectFromEntries } = Object;
6
4
  export const at = name => object => {
7
5
  const r = getOwnPropertyDescriptor(object, name);
@@ -1,15 +1,15 @@
1
- import * as _ from "./module.f.js";
1
+ import { at } from "./module.f.js";
2
2
  export default {
3
3
  ctor: () => {
4
4
  const a = {};
5
- const value = _.at('constructor')(a);
5
+ const value = at('constructor')(a);
6
6
  if (value !== null) {
7
7
  throw value;
8
8
  }
9
9
  },
10
10
  property: () => {
11
11
  const a = { constructor: 42 };
12
- const value = _.at('constructor')(a);
12
+ const value = at('constructor')(a);
13
13
  if (value !== 42) {
14
14
  throw value;
15
15
  }
@@ -1,18 +1,18 @@
1
- import * as _ from "./module.f.js";
1
+ import { contains } from "./module.f.js";
2
2
  export default () => {
3
- if (!_.contains([0, 5])(1)) {
3
+ if (!contains([0, 5])(1)) {
4
4
  throw 1;
5
5
  }
6
- if (!_.contains([0, 5])(0)) {
6
+ if (!contains([0, 5])(0)) {
7
7
  throw 0;
8
8
  }
9
- if (!_.contains([0, 5])(5)) {
9
+ if (!contains([0, 5])(5)) {
10
10
  throw 5;
11
11
  }
12
- if (_.contains([0, 5])(-1)) {
12
+ if (contains([0, 5])(-1)) {
13
13
  throw -1;
14
14
  }
15
- if (_.contains([0, 5])(6)) {
15
+ if (contains([0, 5])(6)) {
16
16
  throw 6;
17
17
  }
18
18
  };
@@ -1,14 +1,14 @@
1
- import * as sortedList from '../sorted_list/module.f.ts';
2
- import * as O from '../function/operator/module.f.ts';
3
- import * as Range from '../range/module.f.ts';
1
+ import { type SortedList } from '../sorted_list/module.f.ts';
2
+ import type { Reduce, Equal } from '../function/operator/module.f.ts';
3
+ import type { Range } from '../range/module.f.ts';
4
4
  export type Entry<T> = [T, number];
5
- export type RangeMap<T> = sortedList.SortedList<Entry<T>>;
5
+ export type RangeMap<T> = SortedList<Entry<T>>;
6
6
  export type RangeMapArray<T> = readonly Entry<T>[];
7
7
  export type Operators<T> = {
8
- readonly union: O.Reduce<T>;
9
- readonly equal: O.Equal<T>;
8
+ readonly union: Reduce<T>;
9
+ readonly equal: Equal<T>;
10
10
  };
11
- export type RangeMerge<T> = O.Reduce<RangeMap<T>>;
11
+ export type RangeMerge<T> = Reduce<RangeMap<T>>;
12
12
  export declare const merge: <T>(op: Operators<T>) => RangeMerge<T>;
13
13
  export declare const get: <T>(def: T) => (value: number) => (rm: RangeMapArray<T>) => T;
14
- export declare const fromRange: <T>(def: T) => (r: Range.Range) => (value: T) => RangeMapArray<T>;
14
+ export declare const fromRange: <T>(def: T) => (r: Range) => (value: T) => RangeMapArray<T>;
@@ -1,12 +1,6 @@
1
- import * as sortedList from "../sorted_list/module.f.js";
2
- const { genericMerge } = sortedList;
3
- import * as list from "../list/module.f.js";
4
- const { next } = list;
5
- import * as Option from "../nullable/module.f.js";
6
- import * as number from "../number/module.f.js";
7
- const { cmp } = number;
8
- import * as O from "../function/operator/module.f.js";
9
- import * as Range from "../range/module.f.js";
1
+ import { genericMerge } from "../sorted_list/module.f.js";
2
+ import { next } from "../list/module.f.js";
3
+ import { cmp } from "../number/module.f.js";
10
4
  const reduceOp = union => equal => state => ([aItem, aMax]) => ([bItem, bMax]) => {
11
5
  const sign = cmp(aMax)(bMax);
12
6
  const min = sign === 1 ? bMax : aMax;
@@ -1,9 +1,7 @@
1
1
  import * as _ from "./module.f.js";
2
- import * as compare from "../function/compare/module.f.js";
3
- const { unsafeCmp } = compare;
2
+ import { unsafeCmp } from "../function/compare/module.f.js";
4
3
  import * as json from "../../json/module.f.js";
5
- import * as object from "../object/module.f.js";
6
- const { sort } = object;
4
+ import { sort } from "../object/module.f.js";
7
5
  import * as sortedSet from "../sorted_set/module.f.js";
8
6
  import * as list from "../list/module.f.js";
9
7
  import * as operator from "../function/operator/module.f.js";
@@ -1,7 +1,6 @@
1
- type Ok<T> = readonly ['ok', T];
2
- type Error<E> = readonly ['error', E];
1
+ export type Ok<T> = readonly ['ok', T];
2
+ export type Error<E> = readonly ['error', E];
3
3
  export type Result<T, E> = Ok<T> | Error<E>;
4
4
  export declare const ok: <T>(value: T) => Ok<T>;
5
5
  export declare const error: <E>(e: E) => Error<E>;
6
6
  export declare const unwrap: <T, E>(r: Result<T, E>) => T;
7
- export {};
@@ -1,16 +1,16 @@
1
- import * as compare from '../function/compare/module.f.ts';
2
- import * as list from '../list/module.f.ts';
3
- import * as option from '../nullable/module.f.ts';
4
- export type SortedList<T> = list.List<T>;
1
+ import type { Sign } from '../function/compare/module.f.ts';
2
+ import { type List } from '../list/module.f.ts';
3
+ import type { Nullable } from '../nullable/module.f.ts';
4
+ export type SortedList<T> = List<T>;
5
5
  type SortedArray<T> = readonly T[];
6
- type Cmp<T> = (a: T) => (b: T) => compare.Sign;
7
- export type ReduceOp<T, S> = (state: S) => (a: T) => (b: T) => readonly [option.Nullable<T>, compare.Sign, S];
8
- export type TailReduce<T, S> = (state: S) => (tail: list.List<T>) => list.List<T>;
6
+ type Cmp<T> = (a: T) => (b: T) => Sign;
7
+ export type ReduceOp<T, S> = (state: S) => (a: T) => (b: T) => readonly [Nullable<T>, Sign, S];
8
+ export type TailReduce<T, S> = (state: S) => (tail: List<T>) => List<T>;
9
9
  type MergeReduce<T, S> = {
10
10
  readonly reduceOp: ReduceOp<T, S>;
11
11
  readonly tailReduce: TailReduce<T, S>;
12
12
  };
13
- export declare const genericMerge: <T, S>({ reduceOp, tailReduce }: MergeReduce<T, S>) => (state: S) => (a: list.List<T>) => (b: list.List<T>) => list.List<T>;
13
+ export declare const genericMerge: <T, S>({ reduceOp, tailReduce }: MergeReduce<T, S>) => (state: S) => (a: List<T>) => (b: List<T>) => List<T>;
14
14
  export declare const merge: <T>(cmp: Cmp<T>) => (a: SortedList<T>) => (b: SortedList<T>) => SortedList<T>;
15
15
  export declare const find: <T>(cmp: Cmp<T>) => (value: T) => (array: SortedArray<T>) => T | null;
16
16
  export {};
@@ -1,9 +1,5 @@
1
- import * as compare from "../function/compare/module.f.js";
2
- import * as list from "../list/module.f.js";
3
- import * as option from "../nullable/module.f.js";
4
- const { next } = list;
5
- import * as f from "../function/module.f.js";
6
- const { identity } = f;
1
+ import { next } from "../list/module.f.js";
2
+ import { identity } from "../function/module.f.js";
7
3
  export const genericMerge = ({ reduceOp, tailReduce }) => {
8
4
  const f = state => a => b => () => {
9
5
  const aResult = next(a);
@@ -1,26 +1,21 @@
1
- import * as _ from "./module.f.js";
2
- import * as compare from "../function/compare/module.f.js";
3
- const { unsafeCmp } = compare;
1
+ import { find, merge } from "./module.f.js";
2
+ import { unsafeCmp } from "../function/compare/module.f.js";
4
3
  import * as json from "../../json/module.f.js";
5
- import * as object from "../object/module.f.js";
6
- const { sort } = object;
7
- import * as list from "../list/module.f.js";
8
- const { toArray, countdown, length } = list;
9
- import * as Map from "../map/module.f.js";
10
- import * as f from "../function/module.f.js";
11
- const { flip } = f;
4
+ import { sort } from "../object/module.f.js";
5
+ import { toArray, countdown, length } from "../list/module.f.js";
6
+ import { flip } from "../function/module.f.js";
12
7
  const stringify = json.stringify(sort);
13
8
  const reverseCmp = flip(unsafeCmp);
14
9
  export default {
15
10
  sortedMergre: [
16
11
  () => {
17
- const result = stringify(toArray(_.merge(unsafeCmp)([2, 3, 4])([1, 3, 5])));
12
+ const result = stringify(toArray(merge(unsafeCmp)([2, 3, 4])([1, 3, 5])));
18
13
  if (result !== '[1,2,3,4,5]') {
19
14
  throw result;
20
15
  }
21
16
  },
22
17
  () => {
23
- const result = stringify(toArray(_.merge(unsafeCmp)([1, 2, 3])([])));
18
+ const result = stringify(toArray(merge(unsafeCmp)([1, 2, 3])([])));
24
19
  if (result !== '[1,2,3]') {
25
20
  throw result;
26
21
  }
@@ -28,7 +23,7 @@ export default {
28
23
  () => {
29
24
  const n = 10_000;
30
25
  const list = countdown(n);
31
- const result = _.merge(reverseCmp)(list)(list);
26
+ const result = merge(reverseCmp)(list)(list);
32
27
  const len = length(result);
33
28
  if (len != n) {
34
29
  throw result;
@@ -37,25 +32,25 @@ export default {
37
32
  ],
38
33
  find: [
39
34
  () => {
40
- const result = _.find(unsafeCmp)(0)([0, 10, 20, 30, 40, 50, 60, 70, 80, 90]);
35
+ const result = find(unsafeCmp)(0)([0, 10, 20, 30, 40, 50, 60, 70, 80, 90]);
41
36
  if (result !== 0) {
42
37
  throw result;
43
38
  }
44
39
  },
45
40
  () => {
46
- const result = _.find(unsafeCmp)(3)([0, 10, 20, 30, 40, 50, 60, 70, 80, 90]);
41
+ const result = find(unsafeCmp)(3)([0, 10, 20, 30, 40, 50, 60, 70, 80, 90]);
47
42
  if (result !== null) {
48
43
  throw result;
49
44
  }
50
45
  },
51
46
  () => {
52
- const result = _.find(unsafeCmp)(77)([0, 10, 20, 30, 40, 50, 60, 70, 80, 90]);
47
+ const result = find(unsafeCmp)(77)([0, 10, 20, 30, 40, 50, 60, 70, 80, 90]);
53
48
  if (result !== null) {
54
49
  throw result;
55
50
  }
56
51
  },
57
52
  () => {
58
- const result = _.find(unsafeCmp)(80)([0, 10, 20, 30, 40, 50, 60, 70, 80, 90]);
53
+ const result = find(unsafeCmp)(80)([0, 10, 20, 30, 40, 50, 60, 70, 80, 90]);
59
54
  if (result !== 80) {
60
55
  throw result;
61
56
  }
@@ -1,6 +1,6 @@
1
- import * as Compare from '../function/compare/module.f.ts';
1
+ import type { Sign } from '../function/compare/module.f.ts';
2
2
  export type SortedSet<T> = readonly T[];
3
- type Cmp<T> = (a: T) => (b: T) => Compare.Sign;
3
+ type Cmp<T> = (a: T) => (b: T) => Sign;
4
4
  export declare const union: <T>(cmp: Cmp<T>) => (a: SortedSet<T>) => (b: SortedSet<T>) => SortedSet<T>;
5
5
  export declare const intersect: <T>(cmp: Cmp<T>) => (a: SortedSet<T>) => (b: SortedSet<T>) => SortedSet<T>;
6
6
  export declare const has: <T>(cmp: Cmp<T>) => (value: T) => (set: SortedSet<T>) => boolean;
@@ -1,8 +1,5 @@
1
- import * as Compare from "../function/compare/module.f.js";
2
- import * as list from "../list/module.f.js";
3
- const { toArray } = list;
4
- import * as sortedList from "../sorted_list/module.f.js";
5
- const { merge, genericMerge, find } = sortedList;
1
+ import { toArray } from "../list/module.f.js";
2
+ import { merge, genericMerge, find } from "../sorted_list/module.f.js";
6
3
  export const union = cmp => a => b => toArray(merge(cmp)(a)(b));
7
4
  export const intersect = cmp => a => b => toArray(intersectMerge(cmp)(a)(b));
8
5
  const tailReduce = () => () => null;