functionalscript 0.3.2 → 0.3.4
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/test/build.ts +1 -1
- package/crypto/sha2/module.f.ts +6 -2
- package/deno.json +1 -1
- package/dev/module.f.ts +1 -1
- package/dev/module.ts +0 -1
- package/dev/test/module.f.ts +2 -2
- package/fsc/module.f.ts +3 -1
- package/html/module.f.ts +6 -2
- package/js/tokenizer/module.f.ts +1 -1
- package/json/serializer/module.f.ts +6 -2
- package/package.json +1 -1
- package/text/ascii/module.f.ts +135 -138
- package/text/sgr/module.f.ts +6 -12
- package/text/utf16/module.f.ts +7 -2
- package/text/utf8/module.f.ts +4 -2
- package/types/bigint/module.f.ts +4 -2
- package/types/byte_set/module.f.ts +8 -4
- package/types/function/operator/module.f.ts +3 -1
- package/types/list/module.f.ts +3 -1
- package/types/number/module.f.ts +12 -6
- package/types/string/module.f.ts +12 -8
- package/types/string_set/module.f.ts +5 -3
package/com/test/build.ts
CHANGED
|
@@ -7,7 +7,7 @@ import * as string from '../../types/string/module.f.ts'
|
|
|
7
7
|
const { join } = string
|
|
8
8
|
const { log, error } = console
|
|
9
9
|
import * as sgr from '../../text/sgr/module.f.ts'
|
|
10
|
-
const { bold, reset } = sgr
|
|
10
|
+
const { bold, reset } = sgr
|
|
11
11
|
import * as list from '../../types/list/module.f.ts'
|
|
12
12
|
|
|
13
13
|
import { fileURLToPath } from 'node:url'
|
package/crypto/sha2/module.f.ts
CHANGED
|
@@ -206,6 +206,10 @@ export const computeSha224
|
|
|
206
206
|
: (input: readonly number[]) => (bitsCount: number) => Hash8
|
|
207
207
|
= compute(init224)
|
|
208
208
|
|
|
209
|
-
export const compress256
|
|
209
|
+
export const compress256
|
|
210
|
+
: (data: Array16) => Hash8
|
|
211
|
+
= compress(init256)
|
|
210
212
|
|
|
211
|
-
export const compress224
|
|
213
|
+
export const compress224
|
|
214
|
+
: (data: Array16) => Hash8
|
|
215
|
+
= compress(init224)
|
package/deno.json
CHANGED
package/dev/module.f.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const todo = () => { throw 'not implemented' }
|
|
1
|
+
export const todo = (): never => { throw 'not implemented' }
|
package/dev/module.ts
CHANGED
|
@@ -88,7 +88,6 @@ export const loadModuleMap = async () => {
|
|
|
88
88
|
name.endsWith('.f.js') ||
|
|
89
89
|
(name.endsWith('.f.ts') && !existsSync(file.substring(0, file.length - 3) + '.js'))
|
|
90
90
|
) {
|
|
91
|
-
console.log(file)
|
|
92
91
|
const source = await import(`../${file}`)
|
|
93
92
|
map.push([file, source.default])
|
|
94
93
|
}
|
package/dev/test/module.f.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as list from '../../types/list/module.f.ts'
|
|
2
2
|
const { fold } = list
|
|
3
|
-
import * as
|
|
4
|
-
const { reset, fgGreen, fgRed, bold } =
|
|
3
|
+
import * as codes from '../../text/sgr/module.f.ts'
|
|
4
|
+
const { reset, fgGreen, fgRed, bold } = codes
|
|
5
5
|
import * as Result from '../../types/result/module.f.ts'
|
|
6
6
|
|
|
7
7
|
type DependencyMap = {
|
package/fsc/module.f.ts
CHANGED
|
@@ -85,7 +85,9 @@ const toInit
|
|
|
85
85
|
: () => ToResult
|
|
86
86
|
= () => () => [[], init]
|
|
87
87
|
|
|
88
|
-
export const init
|
|
88
|
+
export const init
|
|
89
|
+
: ToResult
|
|
90
|
+
= create([
|
|
89
91
|
codePointRange(one(terminal))(toInit),
|
|
90
92
|
rangeSet(['\t', ' ', '\n', '\r'])(toInit),
|
|
91
93
|
range('!')(() => () => [['!'], unexpectedSymbol]),
|
package/html/module.f.ts
CHANGED
|
@@ -100,6 +100,10 @@ export const element
|
|
|
100
100
|
return element3(t)(a === undefined ? [{}, []]: typeof a === 'object' && !(a instanceof Array) ? [a, n] : [{}, [a, ...n]])
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
export const html
|
|
103
|
+
export const html
|
|
104
|
+
: (_: Element) => List<string>
|
|
105
|
+
= compose(element)(listConcat(['<!DOCTYPE html>']))
|
|
104
106
|
|
|
105
|
-
export const htmlToString
|
|
107
|
+
export const htmlToString
|
|
108
|
+
: (_: Element) => string
|
|
109
|
+
= compose(html)(stringConcat)
|
package/js/tokenizer/module.f.ts
CHANGED
|
@@ -59,9 +59,13 @@ const wrap
|
|
|
59
59
|
return input => flat([seqOpen, join(input), seqClose])
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export const objectWrap
|
|
62
|
+
export const objectWrap
|
|
63
|
+
: (input: list.List<list.List<string>>) => list.List<string>
|
|
64
|
+
= wrap('{')('}')
|
|
63
65
|
|
|
64
|
-
export const arrayWrap
|
|
66
|
+
export const arrayWrap
|
|
67
|
+
: (input: list.List<list.List<string>>) => list.List<string>
|
|
68
|
+
= wrap('[')(']')
|
|
65
69
|
|
|
66
70
|
type Entry<T> = O.Entry<Unknown<T>>
|
|
67
71
|
|
package/package.json
CHANGED
package/text/ascii/module.f.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type Range } from '../../types/range/module.f.ts'
|
|
2
2
|
|
|
3
3
|
const at
|
|
4
4
|
: (s: string) => (i: number) => number
|
|
@@ -8,12 +8,10 @@ const at
|
|
|
8
8
|
return r
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const one
|
|
12
|
-
: (s: string) => number
|
|
13
|
-
= s => at(s)(0)
|
|
11
|
+
export const one = (s: string): number => at(s)(0)
|
|
14
12
|
|
|
15
13
|
export const range
|
|
16
|
-
: (s: string) =>
|
|
14
|
+
: (s: string) => Range
|
|
17
15
|
= s => {
|
|
18
16
|
const f = at(s)
|
|
19
17
|
const f0 = f(0)
|
|
@@ -21,202 +19,201 @@ export const range
|
|
|
21
19
|
return [f0, f(1)]
|
|
22
20
|
}
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
// 0x00..
|
|
22
|
+
// 0x00..
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
/** 0x08 */
|
|
25
|
+
export const backspace: number = one('\b')
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
/** 0x09 */
|
|
28
|
+
export const ht: number = one('\t')
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
/** 0x0A */
|
|
31
|
+
export const lf: number = one('\n')
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/** @readonly 0x0D */
|
|
39
|
-
cr: one('\r'),
|
|
33
|
+
/** 0x0C */
|
|
34
|
+
export const ff: number = one('\f')
|
|
40
35
|
|
|
41
|
-
|
|
36
|
+
/** 0x0D */
|
|
37
|
+
export const cr: number = one('\r')
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
space: one(' '),
|
|
39
|
+
// 0x20..
|
|
45
40
|
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
/** 0x20 */
|
|
42
|
+
export const space: number = one(' ')
|
|
48
43
|
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
/** 0x21 */
|
|
45
|
+
export const exclamationMark: number = one('!')
|
|
51
46
|
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
/** 0x22 */
|
|
48
|
+
export const quotationMark: number = one('"')
|
|
54
49
|
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
/** 0x23 */
|
|
51
|
+
export const numberSign: number = one('#')
|
|
57
52
|
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
/** 0x24 */
|
|
54
|
+
export const dollarSign: number = one('$')
|
|
60
55
|
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
/** 0x25 */
|
|
57
|
+
export const percentSign: number = one('%')
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
/** 0x26 */
|
|
60
|
+
export const ampersand: number = one('&')
|
|
66
61
|
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
/** 0x27 */
|
|
63
|
+
export const apostrophe: number = one("'")
|
|
69
64
|
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
/** 0x28 */
|
|
66
|
+
export const leftParenthesis: number = one('(')
|
|
72
67
|
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
/** 0x29 */
|
|
69
|
+
export const rightParenthesis: number = one(')')
|
|
75
70
|
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
/** 0x2A */
|
|
72
|
+
export const asterisk: number = one('*')
|
|
78
73
|
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
/** 0x2B */
|
|
75
|
+
export const plusSign: number = one('+')
|
|
81
76
|
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
/** 0x2C */
|
|
78
|
+
export const comma: number = one(',')
|
|
84
79
|
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
/** 0x2D */
|
|
81
|
+
export const hyphenMinus: number = one('-')
|
|
87
82
|
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
/** 0x2E */
|
|
84
|
+
export const fullStop: number = one('.')
|
|
90
85
|
|
|
91
|
-
|
|
86
|
+
/** 0x2F */
|
|
87
|
+
export const solidus: number = one('/')
|
|
92
88
|
|
|
93
|
-
|
|
94
|
-
digitRange: range('09'),
|
|
89
|
+
// 0x30..
|
|
95
90
|
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
/** 0x30..0x39 */
|
|
92
|
+
export const digitRange: Range = range('09')
|
|
98
93
|
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
/** 0x30 */
|
|
95
|
+
export const digit0: number = one('0')
|
|
101
96
|
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
/** 0x31 */
|
|
98
|
+
export const digit1: number = one('1')
|
|
104
99
|
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
/** 0x32 */
|
|
101
|
+
export const digit2: number = one('2')
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
/** 0x33 */
|
|
104
|
+
export const digit3: number = one('3')
|
|
110
105
|
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
/** 0x34 */
|
|
107
|
+
export const digit4: number = one('4')
|
|
113
108
|
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
/** 0x35 */
|
|
110
|
+
export const digit5: number = one('5')
|
|
116
111
|
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
/** 0x36 */
|
|
113
|
+
export const digit6: number = one('6')
|
|
119
114
|
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
/** 0x37 */
|
|
116
|
+
export const digit7: number = one('7')
|
|
122
117
|
|
|
123
|
-
|
|
124
|
-
|
|
118
|
+
/** 0x38 */
|
|
119
|
+
export const digit8: number = one('8')
|
|
125
120
|
|
|
126
|
-
|
|
127
|
-
|
|
121
|
+
/** 0x39 */
|
|
122
|
+
export const digit9: number = one('9')
|
|
128
123
|
|
|
129
|
-
|
|
130
|
-
|
|
124
|
+
/** 0x3A */
|
|
125
|
+
export const colon: number = one(':')
|
|
131
126
|
|
|
132
|
-
|
|
133
|
-
|
|
127
|
+
/** 0x3B */
|
|
128
|
+
export const semicolon: number = one(';')
|
|
134
129
|
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
/** 0x3C */
|
|
131
|
+
export const lessThanSign: number = one('<')
|
|
137
132
|
|
|
138
|
-
|
|
139
|
-
|
|
133
|
+
/** 0x3D */
|
|
134
|
+
export const equalsSign: number = one('=')
|
|
140
135
|
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
/** 0x3E */
|
|
137
|
+
export const greaterThanSign: number = one('>')
|
|
143
138
|
|
|
144
|
-
|
|
139
|
+
/** 0x3F */
|
|
140
|
+
export const questionMark: number = one('?')
|
|
145
141
|
|
|
146
|
-
|
|
147
|
-
commercialAt: one('@'),
|
|
142
|
+
// 0x40..
|
|
148
143
|
|
|
149
|
-
|
|
150
|
-
|
|
144
|
+
/** 0x40 */
|
|
145
|
+
export const commercialAt: number = one('@')
|
|
151
146
|
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
/** 0x41..0x5A */
|
|
148
|
+
export const latinCapitalLetterRange: Range = range('AZ')
|
|
154
149
|
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
/** 0x41 */
|
|
151
|
+
export const latinCapitalLetterA: number = one('A')
|
|
157
152
|
|
|
158
|
-
|
|
159
|
-
|
|
153
|
+
/** 0x45 */
|
|
154
|
+
export const latinCapitalLetterE: number = one('E')
|
|
160
155
|
|
|
161
|
-
|
|
162
|
-
|
|
156
|
+
/** 0x46 */
|
|
157
|
+
export const latinCapitalLetterF: number = one('F')
|
|
163
158
|
|
|
164
|
-
|
|
165
|
-
|
|
159
|
+
/** 0x5B */
|
|
160
|
+
export const leftSquareBracket: number = one('[')
|
|
166
161
|
|
|
167
|
-
|
|
168
|
-
|
|
162
|
+
/** 0x5C */
|
|
163
|
+
export const reverseSolidus: number = one('\\')
|
|
169
164
|
|
|
170
|
-
|
|
171
|
-
|
|
165
|
+
/** 0x5D */
|
|
166
|
+
export const rightSquareBracket: number = one(']')
|
|
172
167
|
|
|
173
|
-
|
|
174
|
-
|
|
168
|
+
/** 0x5E */
|
|
169
|
+
export const circumflexAccent: number = one('^')
|
|
175
170
|
|
|
176
|
-
|
|
171
|
+
/** 0x5F */
|
|
172
|
+
export const lowLine: number = one('_')
|
|
177
173
|
|
|
178
|
-
|
|
179
|
-
graveAccent: one('`'),
|
|
174
|
+
// 0x60..
|
|
180
175
|
|
|
181
|
-
|
|
182
|
-
|
|
176
|
+
/** 0x60 */
|
|
177
|
+
export const graveAccent: number = one('`')
|
|
183
178
|
|
|
184
|
-
|
|
185
|
-
|
|
179
|
+
/** 0x61..0x7A */
|
|
180
|
+
export const latinSmallLetterRange: Range = range('az')
|
|
186
181
|
|
|
187
|
-
|
|
188
|
-
|
|
182
|
+
/** 0x61 */
|
|
183
|
+
export const latinSmallLetterA: number = one('a')
|
|
189
184
|
|
|
190
|
-
|
|
191
|
-
|
|
185
|
+
/** 0x62 */
|
|
186
|
+
export const latinSmallLetterB: number = one('b')
|
|
192
187
|
|
|
193
|
-
|
|
194
|
-
|
|
188
|
+
/** 0x65 */
|
|
189
|
+
export const latinSmallLetterE: number = one('e')
|
|
195
190
|
|
|
196
|
-
|
|
197
|
-
|
|
191
|
+
/** 0x66 */
|
|
192
|
+
export const latinSmallLetterF: number = one('f')
|
|
198
193
|
|
|
199
|
-
|
|
200
|
-
|
|
194
|
+
/** 0x6E */
|
|
195
|
+
export const latinSmallLetterN: number = one('n')
|
|
201
196
|
|
|
202
|
-
|
|
203
|
-
|
|
197
|
+
/** 0x72 */
|
|
198
|
+
export const latinSmallLetterR: number = one('r')
|
|
204
199
|
|
|
205
|
-
|
|
206
|
-
|
|
200
|
+
/** 0x74 */
|
|
201
|
+
export const latinSmallLetterT: number = one('t')
|
|
207
202
|
|
|
208
|
-
|
|
209
|
-
|
|
203
|
+
/** 0x75 */
|
|
204
|
+
export const latinSmallLetterU: number = one('u')
|
|
210
205
|
|
|
211
|
-
|
|
212
|
-
|
|
206
|
+
/** 0x7A */
|
|
207
|
+
export const latinSmallLetterZ: number = one('z')
|
|
213
208
|
|
|
214
|
-
|
|
215
|
-
|
|
209
|
+
/** 0x7B */
|
|
210
|
+
export const leftCurlyBracket: number = one('{')
|
|
216
211
|
|
|
217
|
-
|
|
218
|
-
|
|
212
|
+
/** 0x7C */
|
|
213
|
+
export const verticalLine: number = one('|')
|
|
219
214
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
215
|
+
/** 0x7D */
|
|
216
|
+
export const rightCurlyBracket: number = one('}')
|
|
217
|
+
|
|
218
|
+
/** 0x7E */
|
|
219
|
+
export const tilde: number = one('~')
|
package/text/sgr/module.f.ts
CHANGED
|
@@ -2,16 +2,10 @@
|
|
|
2
2
|
* https://en.wikipedia.org/wiki/ANSI_escape_code#SGR
|
|
3
3
|
*/
|
|
4
4
|
export const sgr
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
: (c: number) => string
|
|
6
|
+
= c => `\x1b[${c.toString()}m`
|
|
7
7
|
|
|
8
|
-
export const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
bold: sgr(1),
|
|
13
|
-
/** @readonly */
|
|
14
|
-
fgRed: sgr(31),
|
|
15
|
-
/** @readonly */
|
|
16
|
-
fgGreen: sgr(32),
|
|
17
|
-
}
|
|
8
|
+
export const reset: string = sgr(0)
|
|
9
|
+
export const bold: string = sgr(1)
|
|
10
|
+
export const fgRed: string = sgr(31)
|
|
11
|
+
export const fgGreen: string = sgr(32)
|
package/text/utf16/module.f.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
empty,
|
|
8
8
|
type List,
|
|
9
9
|
type Result,
|
|
10
|
+
type Thunk,
|
|
10
11
|
} from '../../types/list/module.f.ts'
|
|
11
12
|
import * as operator from '../../types/function/operator/module.f.ts'
|
|
12
13
|
import { contains } from '../../types/range/module.f.ts'
|
|
@@ -55,9 +56,13 @@ const codePointToUtf16
|
|
|
55
56
|
return [codePoint & 0xffff]
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
export const fromCodePointList
|
|
59
|
+
export const fromCodePointList
|
|
60
|
+
: (input: List<number>) => Thunk<number>
|
|
61
|
+
= flatMap(codePointToUtf16)
|
|
59
62
|
|
|
60
|
-
const u16
|
|
63
|
+
const u16
|
|
64
|
+
: (i: number) => boolean
|
|
65
|
+
= contains([0x0000, 0xFFFF])
|
|
61
66
|
|
|
62
67
|
const utf16ByteToCodePointOp
|
|
63
68
|
: operator.StateScan<u16, Utf16State, List<i32>>
|
package/text/utf8/module.f.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { flatMap, flat, stateScan, type List } from '../../types/list/module.f.ts'
|
|
1
|
+
import { flatMap, flat, stateScan, type List, type Thunk } from '../../types/list/module.f.ts'
|
|
2
2
|
import * as operator from '../../types/function/operator/module.f.ts'
|
|
3
3
|
import * as Array from '../../types/array/module.f.ts'
|
|
4
4
|
|
|
@@ -30,7 +30,9 @@ const codePointToUtf8
|
|
|
30
30
|
return [errorMask]
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export const fromCodePointList
|
|
33
|
+
export const fromCodePointList
|
|
34
|
+
: (input: List<number>) => Thunk<number>
|
|
35
|
+
= flatMap(codePointToUtf8)
|
|
34
36
|
|
|
35
37
|
const utf8StateToError
|
|
36
38
|
: (state: Utf8NonEmptyState) => i32
|
package/types/bigint/module.f.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as compare from '../function/compare/module.f.ts'
|
|
2
2
|
import * as Operator from '../function/operator/module.f.ts'
|
|
3
3
|
const { unsafeCmp } = compare
|
|
4
|
-
import { reduce } from '../list/module.f.ts'
|
|
4
|
+
import { reduce, type List } from '../list/module.f.ts'
|
|
5
5
|
|
|
6
6
|
type Unary = Operator.Unary<bigint, bigint>
|
|
7
7
|
|
|
@@ -9,7 +9,9 @@ export const addition
|
|
|
9
9
|
: (a: bigint) => (b: bigint) => bigint
|
|
10
10
|
= a => b => a + b
|
|
11
11
|
|
|
12
|
-
export const sum
|
|
12
|
+
export const sum
|
|
13
|
+
: (input: List<bigint>) => bigint
|
|
14
|
+
= reduce(addition)(0n)
|
|
13
15
|
|
|
14
16
|
export const abs
|
|
15
17
|
: (a: bigint) => bigint
|
|
@@ -46,13 +46,17 @@ const difference
|
|
|
46
46
|
|
|
47
47
|
// additional operations
|
|
48
48
|
|
|
49
|
-
export const set
|
|
49
|
+
export const set
|
|
50
|
+
: (_: number) => (b: ByteSet) => ByteSet
|
|
51
|
+
= compose(one)(union)
|
|
50
52
|
|
|
51
|
-
export const setRange
|
|
53
|
+
export const setRange
|
|
54
|
+
: (_: readonly [number, number]) => (b: ByteSet) => ByteSet
|
|
55
|
+
= compose(range)(union)
|
|
52
56
|
|
|
53
57
|
export const unset
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
: (n: Byte) => (s: ByteSet) => ByteSet
|
|
59
|
+
= n => s => difference(s)(one(n))
|
|
56
60
|
|
|
57
61
|
const counter = reverse(countdown(256))
|
|
58
62
|
|
package/types/list/module.f.ts
CHANGED
package/types/number/module.f.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { reduce } from '../list/module.f.ts'
|
|
1
|
+
import { reduce, type List } from '../list/module.f.ts'
|
|
2
2
|
import { addition, min as minOp, max as maxOp } from '../function/operator/module.f.ts'
|
|
3
3
|
import * as compare from '../function/compare/module.f.ts'
|
|
4
4
|
const { unsafeCmp } = compare
|
|
5
5
|
|
|
6
|
-
export const sum
|
|
6
|
+
export const sum
|
|
7
|
+
: (input: List<number>) => number
|
|
8
|
+
= reduce(addition)(0)
|
|
7
9
|
|
|
8
|
-
export const min
|
|
10
|
+
export const min
|
|
11
|
+
: (input: List<number>) => number | null
|
|
12
|
+
= reduce(minOp)(null)
|
|
9
13
|
|
|
10
|
-
export const max
|
|
14
|
+
export const max
|
|
15
|
+
: (input: List<number>) => number | null
|
|
16
|
+
= reduce(maxOp)(null)
|
|
11
17
|
|
|
12
18
|
export const cmp
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
: (a: number) => (b: number) => compare.Sign
|
|
20
|
+
= unsafeCmp
|
package/types/string/module.f.ts
CHANGED
|
@@ -6,17 +6,21 @@ const { unsafeCmp } = compare
|
|
|
6
6
|
import { join as joinOp, concat as concatOp, type Reduce } from '../function/operator/module.f.ts'
|
|
7
7
|
|
|
8
8
|
const reduce
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
: (o: Reduce<string>) => (input: list.List<string>) => string
|
|
10
|
+
= o => listReduce(o)('')
|
|
11
11
|
|
|
12
|
-
export const join
|
|
12
|
+
export const join
|
|
13
|
+
: (_: string) => (input: list.List<string>) => string
|
|
14
|
+
= compose(joinOp)(reduce)
|
|
13
15
|
|
|
14
|
-
export const concat
|
|
16
|
+
export const concat
|
|
17
|
+
: (input: list.List<string>) => string
|
|
18
|
+
= reduce(concatOp)
|
|
15
19
|
|
|
16
20
|
export const repeat
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
: (n: string) => (v: number) => string
|
|
22
|
+
= v => compose(listRepeat(v))(concat)
|
|
19
23
|
|
|
20
24
|
export const cmp
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
: (a: string) => (b: string) => compare.Sign
|
|
26
|
+
= unsafeCmp
|
|
@@ -28,8 +28,10 @@ export const set
|
|
|
28
28
|
: (value: string) => (s: StringSet) => StringSet
|
|
29
29
|
= value => btreeSet(cmp(value))(() => value)
|
|
30
30
|
|
|
31
|
-
export const fromValues
|
|
31
|
+
export const fromValues
|
|
32
|
+
: (input: List<string>) => StringSet
|
|
33
|
+
= fold(set)(null)
|
|
32
34
|
|
|
33
35
|
export const remove
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
: (value: string) => (s: StringSet) => StringSet
|
|
37
|
+
= compose(cmp)(btreeRemove)
|