functionalscript 0.1.609 → 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.
- package/com/cpp/module.f.d.mts +4 -8
- package/com/cpp/module.f.mjs +20 -25
- package/com/cpp/testlib.f.mjs +3 -4
- package/com/cs/module.f.d.mts +4 -8
- package/com/cs/module.f.mjs +18 -23
- package/com/cs/testlib.f.mjs +3 -5
- package/com/rust/module.f.d.mts +3 -7
- package/com/rust/module.f.mjs +25 -30
- package/com/rust/testlib.f.mjs +3 -5
- package/com/test/build.f.d.mts +2 -2
- package/com/test/build.f.mjs +2 -2
- package/com/test/build.mjs +4 -4
- package/com/types/module.f.d.mts +5 -10
- package/com/types/module.f.mjs +5 -12
- package/commonjs/build/module.f.d.mts +13 -17
- package/commonjs/build/module.f.mjs +23 -28
- package/commonjs/build/test.f.mjs +4 -4
- package/commonjs/module/function/module.f.d.mts +0 -2
- package/commonjs/module/function/module.f.mjs +0 -2
- package/commonjs/module/module.f.d.mts +16 -21
- package/commonjs/module/module.f.mjs +2 -9
- package/commonjs/module.d.mts +1 -5
- package/commonjs/module.f.d.mts +0 -2
- package/commonjs/module.f.mjs +0 -2
- package/commonjs/module.mjs +2 -7
- package/commonjs/package/dependencies/module.f.d.mts +3 -7
- package/commonjs/package/dependencies/module.f.mjs +5 -10
- package/commonjs/package/dependencies/test.f.mjs +1 -1
- package/commonjs/package/module.f.d.mts +12 -18
- package/commonjs/package/module.f.mjs +6 -13
- package/commonjs/package/test.f.mjs +1 -1
- package/commonjs/path/module.f.d.mts +25 -32
- package/commonjs/path/module.f.mjs +12 -23
- package/commonjs/path/test.f.mjs +11 -11
- package/commonjs/test.mjs +1 -1
- package/dev/module.f.d.mts +1 -4
- package/dev/module.f.mjs +1 -4
- package/dev/test/module.f.d.mts +2 -3
- package/dev/test/module.f.mjs +4 -6
- package/djs/module.f.d.mts +13 -18
- package/djs/module.f.mjs +12 -19
- package/djs/parser/module.f.d.mts +11 -15
- package/djs/parser/module.f.mjs +18 -24
- package/djs/parser/test.f.mjs +9 -9
- package/djs/test.f.mjs +4 -4
- package/djs/tokenizer/module.f.d.mts +6 -10
- package/djs/tokenizer/module.f.mjs +18 -23
- package/djs/tokenizer/test.f.mjs +6 -6
- package/fsc/module.f.d.mts +4 -9
- package/fsc/module.f.mjs +17 -24
- package/fsc/test.f.mjs +3 -3
- package/fsm/module.f.d.mts +13 -20
- package/fsm/module.f.mjs +27 -38
- package/fsm/test.f.mjs +8 -8
- package/html/module.f.d.mts +7 -12
- package/html/module.f.mjs +14 -23
- package/html/test.f.mjs +4 -4
- package/js/tokenizer/module.f.d.mts +10 -15
- package/js/tokenizer/module.f.mjs +55 -62
- package/js/tokenizer/test.f.mjs +6 -6
- package/json/module.f.d.mts +18 -26
- package/json/module.f.mjs +18 -31
- package/json/parser/module.f.d.mts +9 -13
- package/json/parser/module.f.mjs +9 -14
- package/json/parser/test.f.mjs +7 -7
- package/json/serializer/module.f.d.mts +11 -20
- package/json/serializer/module.f.mjs +14 -29
- package/json/serializer/test.f.mjs +2 -2
- package/json/test.f.mjs +3 -3
- package/json/tokenizer/module.f.d.mts +6 -10
- package/json/tokenizer/module.f.mjs +14 -19
- package/json/tokenizer/test.f.mjs +6 -6
- package/jsr.json +1 -1
- package/nodejs/version/main.mjs +1 -1
- package/nodejs/version/module.f.d.mts +4 -9
- package/nodejs/version/module.f.mjs +2 -7
- package/nodejs/version/test.f.mjs +3 -3
- package/package.json +1 -1
- package/prime_field/module.f.d.mts +20 -23
- package/prime_field/module.f.mjs +9 -12
- package/prime_field/test.f.mjs +1 -1
- package/secp/module.f.d.mts +27 -28
- package/secp/module.f.mjs +38 -39
- package/secp/test.f.mjs +4 -4
- package/sha2/module.f.d.mts +8 -16
- package/sha2/module.f.mjs +7 -20
- package/sha2/test.f.mjs +4 -4
- package/text/ascii/module.f.d.mts +69 -72
- package/text/ascii/module.f.mjs +5 -10
- package/text/ascii/test.f.mjs +3 -3
- package/text/module.f.d.mts +9 -14
- package/text/module.f.mjs +7 -14
- package/text/sgr/module.f.d.mts +7 -9
- package/text/sgr/module.f.mjs +2 -4
- package/text/test.f.mjs +3 -3
- package/text/utf16/module.f.d.mts +8 -15
- package/text/utf16/module.f.mjs +17 -28
- package/text/utf16/test.f.mjs +5 -5
- package/text/utf8/module.f.d.mts +4 -9
- package/text/utf8/module.f.mjs +9 -16
- package/text/utf8/test.f.mjs +4 -4
- package/types/array/module.f.d.mts +14 -24
- package/types/array/module.f.mjs +8 -25
- package/types/array/test.f.mjs +3 -3
- package/types/bigfloat/module.f.d.mts +4 -9
- package/types/bigfloat/module.f.mjs +3 -10
- package/types/bigfloat/test.f.mjs +1 -1
- package/types/bigint/module.f.d.mts +16 -64
- package/types/bigint/module.f.mjs +11 -30
- package/types/bigint/test.f.mjs +1 -1
- package/types/btree/find/module.f.d.mts +20 -26
- package/types/btree/find/module.f.mjs +8 -17
- package/types/btree/find/test.f.mjs +7 -7
- package/types/btree/module.f.d.mts +4 -8
- package/types/btree/module.f.mjs +6 -11
- package/types/btree/remove/module.f.d.mts +7 -12
- package/types/btree/remove/module.f.mjs +10 -17
- package/types/btree/remove/test.f.mjs +5 -5
- package/types/btree/set/module.f.d.mts +3 -7
- package/types/btree/set/module.f.mjs +4 -9
- package/types/btree/set/test.f.mjs +4 -4
- package/types/btree/test.f.mjs +9 -9
- package/types/btree/types/module.f.d.mts +0 -2
- package/types/btree/types/module.f.mjs +0 -2
- package/types/byte_set/module.f.d.mts +16 -29
- package/types/byte_set/module.f.mjs +14 -39
- package/types/byte_set/test.f.mjs +5 -5
- package/types/function/compare/module.f.d.mts +9 -15
- package/types/function/compare/module.f.mjs +3 -12
- package/types/function/compare/test.f.mjs +1 -1
- package/types/function/module.f.d.mts +20 -27
- package/types/function/module.f.mjs +4 -15
- package/types/function/operator/module.f.d.mts +28 -43
- package/types/function/operator/module.f.mjs +14 -41
- package/types/function/test.f.mjs +1 -1
- package/types/list/module.f.d.mts +56 -91
- package/types/list/module.f.mjs +45 -114
- package/types/list/test.f.mjs +10 -10
- package/types/map/module.f.d.mts +15 -24
- package/types/map/module.f.mjs +15 -30
- package/types/map/test.f.mjs +2 -2
- package/types/nibble_set/module.f.d.mts +10 -20
- package/types/nibble_set/module.f.mjs +7 -24
- package/types/nibble_set/test.f.mjs +2 -2
- package/types/nullable/module.f.d.mts +3 -8
- package/types/nullable/module.f.mjs +2 -9
- package/types/nullable/test.f.mjs +1 -1
- package/types/number/module.f.d.mts +7 -13
- package/types/number/module.f.mjs +8 -19
- package/types/number/test.f.mjs +1 -1
- package/types/object/module.f.d.mts +11 -18
- package/types/object/module.f.mjs +9 -20
- package/types/object/test.f.mjs +1 -1
- package/types/range/module.f.d.mts +3 -8
- package/types/range/module.f.mjs +2 -9
- package/types/range/test.f.mjs +1 -1
- package/types/range_map/module.f.d.mts +9 -15
- package/types/range_map/module.f.mjs +9 -18
- package/types/range_map/test.f.mjs +32 -32
- package/types/result/module.d.mts +3 -3
- package/types/result/module.f.d.mts +6 -12
- package/types/result/module.f.mjs +3 -12
- package/types/result/module.mjs +2 -2
- package/types/sorted_list/module.f.d.mts +22 -28
- package/types/sorted_list/module.f.mjs +10 -19
- package/types/sorted_list/test.f.mjs +7 -7
- package/types/sorted_set/module.f.d.mts +6 -12
- package/types/sorted_set/module.f.mjs +7 -16
- package/types/sorted_set/test.f.mjs +7 -7
- package/types/string/module.f.d.mts +8 -14
- package/types/string/module.f.mjs +10 -21
- package/types/string/test.f.mjs +2 -2
- package/types/string_set/module.f.d.mts +8 -16
- package/types/string_set/module.f.mjs +12 -27
- package/types/string_set/test.f.mjs +1 -1
|
@@ -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
|
-
|
|
35
|
-
/** @type {Reduce<
|
|
36
|
-
|
|
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
|
-
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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,117 +1,82 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
export let empty: null;
|
|
3
|
-
export { concat };
|
|
4
|
-
export { next };
|
|
5
|
-
export { iterable };
|
|
6
|
-
export { toArray };
|
|
7
|
-
export { flat };
|
|
8
|
-
export { map };
|
|
9
|
-
export { flatMap };
|
|
10
|
-
export { filter };
|
|
11
|
-
export { filterMap };
|
|
12
|
-
export { takeWhile };
|
|
13
|
-
export { take };
|
|
14
|
-
export { dropWhile };
|
|
15
|
-
export { drop };
|
|
16
|
-
export { first };
|
|
17
|
-
export { last };
|
|
18
|
-
export { find };
|
|
19
|
-
export { some };
|
|
20
|
-
export { every };
|
|
21
|
-
export { isEmpty };
|
|
22
|
-
export { includes };
|
|
23
|
-
export { countdown };
|
|
24
|
-
export { repeat };
|
|
25
|
-
export { cycle };
|
|
26
|
-
export { scan };
|
|
27
|
-
export { stateScan };
|
|
28
|
-
export { foldScan };
|
|
29
|
-
export { fold };
|
|
30
|
-
export { reduce };
|
|
31
|
-
export { length };
|
|
32
|
-
export { entries };
|
|
33
|
-
export { reverse };
|
|
34
|
-
export { zip };
|
|
35
|
-
export { equal };
|
|
36
|
-
}
|
|
37
|
-
export default _default;
|
|
38
|
-
export type List<T> = NotLazy<T> | Thunk<T>;
|
|
39
|
-
export type NotLazy<T> = Result<T> | Concat<T> | readonly T[];
|
|
40
|
-
export type Empty = null;
|
|
41
|
-
export type Result<T> = Empty | NonEmpty<T>;
|
|
42
|
-
export type Thunk<T> = () => List<T>;
|
|
43
|
-
export type NonEmpty<T> = {
|
|
44
|
-
readonly first: T;
|
|
45
|
-
readonly tail: List<T>;
|
|
46
|
-
};
|
|
47
|
-
export type Concat<T> = {
|
|
48
|
-
readonly head: List<T>;
|
|
49
|
-
readonly tail: List<T>;
|
|
50
|
-
};
|
|
51
|
-
export type Entry<T> = readonly [number, T];
|
|
52
1
|
/** @type {<T>(head: List<T>) => (tail: List<T>) => List<T>} */
|
|
53
|
-
|
|
2
|
+
export const concat: <T>(head: List<T>) => (tail: List<T>) => List<T>;
|
|
54
3
|
/** @type {<T>(list: List<T>) => Result<T>} */
|
|
55
|
-
|
|
4
|
+
export const next: <T>(list: List<T>) => Result<T>;
|
|
56
5
|
/** @type {<T>(list: List<T>) => Iterable<T>} */
|
|
57
|
-
|
|
6
|
+
export const iterable: <T>(list: List<T>) => Iterable<T>;
|
|
58
7
|
/** @type {<T>(list: List<T>) => readonly T[]} */
|
|
59
|
-
|
|
8
|
+
export const toArray: <T>(list: List<T>) => readonly T[];
|
|
60
9
|
/** @type {<T>(list: List<List<T>>) => Thunk<T>} */
|
|
61
|
-
|
|
10
|
+
export const flat: <T>(list: List<List<T>>) => Thunk<T>;
|
|
62
11
|
/** @type {<I, O>(f: (value: I) => O) => (input: List<I>) => Thunk<O>} */
|
|
63
|
-
|
|
12
|
+
export const map: <I, O>(f: (value: I) => O) => (input: List<I>) => Thunk<O>;
|
|
64
13
|
/** @type {<I, O>(f: (value: I) => List<O>) => (input: List<I>) => Thunk<O>} */
|
|
65
|
-
|
|
14
|
+
export const flatMap: <I, O>(f: (value: I) => List<O>) => (input: List<I>) => Thunk<O>;
|
|
66
15
|
/** @type {<T>(f: (value: T) => boolean) => (input: List<T>) => Thunk<T>} */
|
|
67
|
-
|
|
16
|
+
export const filter: <T>(f: (value: T) => boolean) => (input: List<T>) => Thunk<T>;
|
|
68
17
|
/** @type {<I, O>(f: (value: I) => O|null) => (input: List<I>) => Thunk<O>} */
|
|
69
|
-
|
|
18
|
+
export const filterMap: <I, O>(f: (value: I) => O | null) => (input: List<I>) => Thunk<O>;
|
|
70
19
|
/** @type {<T>(f: (value: T) => boolean) => (input: List<T>) => Thunk<T>} */
|
|
71
|
-
|
|
20
|
+
export const takeWhile: <T>(f: (value: T) => boolean) => (input: List<T>) => Thunk<T>;
|
|
72
21
|
/** @type {(n: number) => <T>(input: List<T>) => Thunk<T>} */
|
|
73
|
-
|
|
22
|
+
export const take: (n: number) => <T>(input: List<T>) => Thunk<T>;
|
|
74
23
|
/** @type {<T>(f: (value: T) => boolean) => (input: List<T>) => Thunk<T>} */
|
|
75
|
-
|
|
24
|
+
export const dropWhile: <T>(f: (value: T) => boolean) => (input: List<T>) => Thunk<T>;
|
|
76
25
|
/** @type {(n: number) => <T>(input: List<T>) => Thunk<T>} */
|
|
77
|
-
|
|
26
|
+
export const drop: (n: number) => <T>(input: List<T>) => Thunk<T>;
|
|
78
27
|
/** @type {<D>(def: D) => <T>(input: List<T>) => D|T} */
|
|
79
|
-
|
|
28
|
+
export const first: <D>(def: D) => <T>(input: List<T>) => D | T;
|
|
80
29
|
/** @type {<D>(first: D) => <T>(tail: List<T>) => D|T} */
|
|
81
|
-
|
|
30
|
+
export const last: <D>(first: D) => <T>(tail: List<T>) => D | T;
|
|
82
31
|
/** @type {<D>(def: D) => <T>(f: (value: T) => boolean) => (input: List<T>) => D|T} */
|
|
83
|
-
|
|
32
|
+
export const find: <D>(def: D) => <T>(f: (value: T) => boolean) => (input: List<T>) => D | T;
|
|
84
33
|
/** @type {(input: List<boolean>) => boolean} */
|
|
85
|
-
|
|
86
|
-
declare const every: import("../function/module.f.mjs").Func<List<boolean>, boolean>;
|
|
34
|
+
export const some: (input: List<boolean>) => boolean;
|
|
87
35
|
/** @type {<T>(input: List<T>) => boolean} */
|
|
88
|
-
|
|
36
|
+
export const isEmpty: <T>(input: List<T>) => boolean;
|
|
37
|
+
export const every: function_.Func<List<boolean>, boolean>;
|
|
89
38
|
/** @type {<T>(value: T) => (sequence: List<T>) => boolean} */
|
|
90
|
-
|
|
39
|
+
export const includes: <T>(value: T) => (sequence: List<T>) => boolean;
|
|
91
40
|
/** @type {(count: number) => Thunk<number>} */
|
|
92
|
-
|
|
41
|
+
export const countdown: (count: number) => Thunk<number>;
|
|
93
42
|
/** @type {<T>(v: T) => (c: number) => Thunk<T>} */
|
|
94
|
-
|
|
43
|
+
export const repeat: <T>(v: T) => (c: number) => Thunk<T>;
|
|
95
44
|
/** @type {<T>(list: List<T>) => List<T>} */
|
|
96
|
-
|
|
97
|
-
/** @type {<I, O>(op:
|
|
98
|
-
|
|
99
|
-
/** @type {<I, S, O>(op:
|
|
100
|
-
|
|
101
|
-
/** @type {<I,O>(op:
|
|
102
|
-
|
|
103
|
-
/** @type {<I,O>(op:
|
|
104
|
-
|
|
105
|
-
/** @type {<T>(op:
|
|
106
|
-
|
|
45
|
+
export const cycle: <T>(list: List<T>) => List<T>;
|
|
46
|
+
/** @type {<I, O>(op: operator.Scan<I, O>) => (input: List<I>) => Thunk<O>} */
|
|
47
|
+
export const scan: <I, O>(op: operator.Scan<I, O>) => (input: List<I>) => Thunk<O>;
|
|
48
|
+
/** @type {<I, S, O>(op: operator.StateScan<I, S, O>) => (init: S) => (input: List<I>) => Thunk<O>} */
|
|
49
|
+
export const stateScan: <I, S, O>(op: operator.StateScan<I, S, O>) => (init: S) => (input: List<I>) => Thunk<O>;
|
|
50
|
+
/** @type {<I,O>(op: operator.Fold<I, O>) => (init: O) => (input: List<I>) => Thunk<O>} */
|
|
51
|
+
export const foldScan: <I, O>(op: operator.Fold<I, O>) => (init: O) => (input: List<I>) => Thunk<O>;
|
|
52
|
+
/** @type {<I,O>(op: operator.Fold<I, O>) => (init: O) => (input: List<I>) => O} */
|
|
53
|
+
export const fold: <I, O>(op: operator.Fold<I, O>) => (init: O) => (input: List<I>) => O;
|
|
54
|
+
/** @type {<T>(op: operator.Reduce<T>) => <D>(def: D) => (input: List<T>) => D|T} */
|
|
55
|
+
export const reduce: <T>(op: operator.Reduce<T>) => <D>(def: D) => (input: List<T>) => D | T;
|
|
107
56
|
/** @type {<T>(input: List<T>) => number} */
|
|
108
|
-
|
|
57
|
+
export const length: <T>(input: List<T>) => number;
|
|
109
58
|
/** @type {<T>(input: List<T>) => Thunk<Entry<T>>} */
|
|
110
|
-
|
|
59
|
+
export const entries: <T>(input: List<T>) => Thunk<Entry<T>>;
|
|
111
60
|
/** @type {<T>(input: List<T>) => List<T>} */
|
|
112
|
-
|
|
61
|
+
export const reverse: <T>(input: List<T>) => List<T>;
|
|
113
62
|
/** @type {<A>(a: List<A>) => <B>(b: List<B>) => Thunk<readonly[A, B]>} */
|
|
114
|
-
|
|
115
|
-
/** @type {<T>(e:
|
|
116
|
-
|
|
117
|
-
|
|
63
|
+
export const zip: <A>(a: List<A>) => <B>(b: List<B>) => Thunk<readonly [A, B]>;
|
|
64
|
+
/** @type {<T>(e: operator.Equal<T>) => (a: List<T>) => (b: List<T>) => boolean} */
|
|
65
|
+
export const equal: <T>(e: operator.Equal<T>) => (a: List<T>) => (b: List<T>) => boolean;
|
|
66
|
+
export const empty: null;
|
|
67
|
+
export type List<T> = NotLazy<T> | Thunk<T>;
|
|
68
|
+
export type NotLazy<T> = Result<T> | Concat<T> | readonly T[];
|
|
69
|
+
export type Empty = null;
|
|
70
|
+
export type Result<T> = Empty | NonEmpty<T>;
|
|
71
|
+
export type Thunk<T> = () => List<T>;
|
|
72
|
+
export type NonEmpty<T> = {
|
|
73
|
+
readonly first: T;
|
|
74
|
+
readonly tail: List<T>;
|
|
75
|
+
};
|
|
76
|
+
export type Concat<T> = {
|
|
77
|
+
readonly head: List<T>;
|
|
78
|
+
readonly tail: List<T>;
|
|
79
|
+
};
|
|
80
|
+
export type Entry<T> = readonly [number, T];
|
|
81
|
+
import * as function_ from '../function/module.f.mjs';
|
|
82
|
+
import * as operator from '../function/operator/module.f.mjs';
|