functionalscript 0.3.0 → 0.3.2
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/.github/workflows/ci.yml +1 -0
- package/.github/workflows/npm-publish.yml +1 -2
- package/deno.json +61 -61
- package/dev/module.ts +1 -1
- package/fsc/module.f.ts +23 -17
- package/html/module.f.ts +15 -18
- package/package.json +1 -1
- package/text/utf16/module.f.ts +29 -22
- package/text/utf8/module.f.ts +11 -12
- package/types/bigint/module.f.ts +1 -2
- package/types/byte_set/module.f.ts +1 -2
- package/types/list/module.f.ts +18 -15
- package/types/number/module.f.ts +2 -4
- package/types/string/module.f.ts +3 -5
- package/types/string_set/module.f.ts +4 -6
package/.github/workflows/ci.yml
CHANGED
|
@@ -27,12 +27,11 @@ jobs:
|
|
|
27
27
|
- run: npm ci
|
|
28
28
|
- run: npm run version
|
|
29
29
|
- run: npm run index
|
|
30
|
-
- run: npm run tscp
|
|
31
30
|
- run: npm publish
|
|
32
31
|
continue-on-error: true
|
|
33
32
|
env:
|
|
34
33
|
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
|
35
|
-
- run: deno publish --allow-dirty
|
|
34
|
+
- run: deno publish --allow-dirty --allow-slow-types
|
|
36
35
|
continue-on-error: true
|
|
37
36
|
|
|
38
37
|
|
package/deno.json
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@functionalscript/functionalscript",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"exports": {
|
|
6
|
-
"./com/cpp": "./
|
|
7
|
-
"./com/cs": "./
|
|
8
|
-
"./com/rust": "./
|
|
9
|
-
"./com/types": "./
|
|
10
|
-
"./commonjs/build": "./
|
|
11
|
-
"./commonjs": "./
|
|
12
|
-
"./commonjs/module/function": "./
|
|
13
|
-
"./commonjs/module": "./
|
|
14
|
-
"./commonjs/package/dependencies": "./
|
|
15
|
-
"./commonjs/package": "./
|
|
16
|
-
"./commonjs/path": "./
|
|
17
|
-
"./crypto/prime_field": "./
|
|
18
|
-
"./crypto/secp": "./
|
|
19
|
-
"./crypto/sha2": "./
|
|
20
|
-
"./dev": "./
|
|
21
|
-
"./dev/test": "./
|
|
22
|
-
"./djs": "./
|
|
23
|
-
"./djs/parser": "./
|
|
24
|
-
"./djs/serializer": "./
|
|
25
|
-
"./djs/tokenizer": "./
|
|
26
|
-
"./fsc": "./
|
|
27
|
-
"./fsm": "./
|
|
28
|
-
"./html": "./
|
|
29
|
-
"./js/tokenizer": "./
|
|
30
|
-
"./json": "./
|
|
31
|
-
"./json/parser": "./
|
|
32
|
-
"./json/serializer": "./
|
|
33
|
-
"./json/tokenizer": "./
|
|
34
|
-
"./nodejs/version": "./
|
|
35
|
-
"./text/ascii": "./
|
|
36
|
-
"./text": "./
|
|
37
|
-
"./text/sgr": "./
|
|
38
|
-
"./text/utf16": "./
|
|
39
|
-
"./text/utf8": "./
|
|
40
|
-
"./types/array": "./
|
|
41
|
-
"./types/bigfloat": "./
|
|
42
|
-
"./types/bigint": "./
|
|
43
|
-
"./types/bit_vec": "./
|
|
44
|
-
"./types/btree/find": "./
|
|
45
|
-
"./types/btree": "./
|
|
46
|
-
"./types/btree/remove": "./
|
|
47
|
-
"./types/btree/set": "./
|
|
48
|
-
"./types/btree/types": "./
|
|
49
|
-
"./types/byte_set": "./
|
|
50
|
-
"./types/function/compare": "./
|
|
51
|
-
"./types/function": "./
|
|
52
|
-
"./types/function/operator": "./
|
|
53
|
-
"./types/list": "./
|
|
54
|
-
"./types/map": "./
|
|
55
|
-
"./types/nibble_set": "./
|
|
56
|
-
"./types/nullable": "./
|
|
57
|
-
"./types/number": "./
|
|
58
|
-
"./types/object": "./
|
|
59
|
-
"./types/range": "./
|
|
60
|
-
"./types/range_map": "./
|
|
61
|
-
"./types/result": "./
|
|
62
|
-
"./types/sorted_list": "./
|
|
63
|
-
"./types/sorted_set": "./
|
|
64
|
-
"./types/string": "./
|
|
65
|
-
"./types/string_set": "./
|
|
6
|
+
"./com/cpp": "./com/cpp/module.f.ts",
|
|
7
|
+
"./com/cs": "./com/cs/module.f.ts",
|
|
8
|
+
"./com/rust": "./com/rust/module.f.ts",
|
|
9
|
+
"./com/types": "./com/types/module.f.ts",
|
|
10
|
+
"./commonjs/build": "./commonjs/build/module.f.ts",
|
|
11
|
+
"./commonjs": "./commonjs/module.f.ts",
|
|
12
|
+
"./commonjs/module/function": "./commonjs/module/function/module.f.ts",
|
|
13
|
+
"./commonjs/module": "./commonjs/module/module.f.ts",
|
|
14
|
+
"./commonjs/package/dependencies": "./commonjs/package/dependencies/module.f.ts",
|
|
15
|
+
"./commonjs/package": "./commonjs/package/module.f.ts",
|
|
16
|
+
"./commonjs/path": "./commonjs/path/module.f.ts",
|
|
17
|
+
"./crypto/prime_field": "./crypto/prime_field/module.f.ts",
|
|
18
|
+
"./crypto/secp": "./crypto/secp/module.f.ts",
|
|
19
|
+
"./crypto/sha2": "./crypto/sha2/module.f.ts",
|
|
20
|
+
"./dev": "./dev/module.f.ts",
|
|
21
|
+
"./dev/test": "./dev/test/module.f.ts",
|
|
22
|
+
"./djs": "./djs/module.f.ts",
|
|
23
|
+
"./djs/parser": "./djs/parser/module.f.ts",
|
|
24
|
+
"./djs/serializer": "./djs/serializer/module.f.ts",
|
|
25
|
+
"./djs/tokenizer": "./djs/tokenizer/module.f.ts",
|
|
26
|
+
"./fsc": "./fsc/module.f.ts",
|
|
27
|
+
"./fsm": "./fsm/module.f.ts",
|
|
28
|
+
"./html": "./html/module.f.ts",
|
|
29
|
+
"./js/tokenizer": "./js/tokenizer/module.f.ts",
|
|
30
|
+
"./json": "./json/module.f.ts",
|
|
31
|
+
"./json/parser": "./json/parser/module.f.ts",
|
|
32
|
+
"./json/serializer": "./json/serializer/module.f.ts",
|
|
33
|
+
"./json/tokenizer": "./json/tokenizer/module.f.ts",
|
|
34
|
+
"./nodejs/version": "./nodejs/version/module.f.ts",
|
|
35
|
+
"./text/ascii": "./text/ascii/module.f.ts",
|
|
36
|
+
"./text": "./text/module.f.ts",
|
|
37
|
+
"./text/sgr": "./text/sgr/module.f.ts",
|
|
38
|
+
"./text/utf16": "./text/utf16/module.f.ts",
|
|
39
|
+
"./text/utf8": "./text/utf8/module.f.ts",
|
|
40
|
+
"./types/array": "./types/array/module.f.ts",
|
|
41
|
+
"./types/bigfloat": "./types/bigfloat/module.f.ts",
|
|
42
|
+
"./types/bigint": "./types/bigint/module.f.ts",
|
|
43
|
+
"./types/bit_vec": "./types/bit_vec/module.f.ts",
|
|
44
|
+
"./types/btree/find": "./types/btree/find/module.f.ts",
|
|
45
|
+
"./types/btree": "./types/btree/module.f.ts",
|
|
46
|
+
"./types/btree/remove": "./types/btree/remove/module.f.ts",
|
|
47
|
+
"./types/btree/set": "./types/btree/set/module.f.ts",
|
|
48
|
+
"./types/btree/types": "./types/btree/types/module.f.ts",
|
|
49
|
+
"./types/byte_set": "./types/byte_set/module.f.ts",
|
|
50
|
+
"./types/function/compare": "./types/function/compare/module.f.ts",
|
|
51
|
+
"./types/function": "./types/function/module.f.ts",
|
|
52
|
+
"./types/function/operator": "./types/function/operator/module.f.ts",
|
|
53
|
+
"./types/list": "./types/list/module.f.ts",
|
|
54
|
+
"./types/map": "./types/map/module.f.ts",
|
|
55
|
+
"./types/nibble_set": "./types/nibble_set/module.f.ts",
|
|
56
|
+
"./types/nullable": "./types/nullable/module.f.ts",
|
|
57
|
+
"./types/number": "./types/number/module.f.ts",
|
|
58
|
+
"./types/object": "./types/object/module.f.ts",
|
|
59
|
+
"./types/range": "./types/range/module.f.ts",
|
|
60
|
+
"./types/range_map": "./types/range_map/module.f.ts",
|
|
61
|
+
"./types/result": "./types/result/module.f.ts",
|
|
62
|
+
"./types/sorted_list": "./types/sorted_list/module.f.ts",
|
|
63
|
+
"./types/sorted_set": "./types/sorted_set/module.f.ts",
|
|
64
|
+
"./types/string": "./types/string/module.f.ts",
|
|
65
|
+
"./types/string_set": "./types/string_set/module.f.ts"
|
|
66
66
|
},
|
|
67
67
|
"tasks": {
|
|
68
68
|
"doc": "deno doc --html **/module.f.ts",
|
package/dev/module.ts
CHANGED
|
@@ -188,7 +188,7 @@ export const index = async () => {
|
|
|
188
188
|
const n = '/module.f.ts'
|
|
189
189
|
const jsr_json = JSON.parse(await readFile(jj, { encoding: 'utf8' }))
|
|
190
190
|
const list = Object.keys(await loadModuleMap()).filter(v => v.endsWith(n))
|
|
191
|
-
const exportsA = list.filter(v => !v.startsWith('./out')).map(v => [v.replace(n, ''),
|
|
191
|
+
const exportsA = list.filter(v => !v.startsWith('./out')).map(v => [v.replace(n, ''), `./${v.substring(2)}`])
|
|
192
192
|
const exports = Object.fromEntries(exportsA)
|
|
193
193
|
await writeFile(
|
|
194
194
|
jj,
|
package/fsc/module.f.ts
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import * as operator from '../types/function/operator/module.f.ts'
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
merge as rangeMapMerge,
|
|
4
|
+
fromRange,
|
|
5
|
+
get,
|
|
6
|
+
type RangeMapArray,
|
|
7
|
+
type RangeMerge,
|
|
8
|
+
} from '../types/range_map/module.f.ts'
|
|
4
9
|
import * as list from '../types/list/module.f.ts'
|
|
5
10
|
const { reduce: listReduce } = list
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import * as f from '../types/function/module.f.ts'
|
|
10
|
-
const { fn } = f
|
|
11
|
-
import * as _range from '../types/range/module.f.ts'
|
|
12
|
-
const { one } = _range
|
|
11
|
+
import { range as asciiRange } from '../text/ascii/module.f.ts'
|
|
12
|
+
import { fn } from '../types/function/module.f.ts'
|
|
13
|
+
import { one, type Range } from '../types/range/module.f.ts'
|
|
13
14
|
const { toArray, map } = list
|
|
14
15
|
|
|
16
|
+
const fromCharCode = String.fromCharCode
|
|
17
|
+
|
|
15
18
|
type Result = readonly[readonly string[], ToResult]
|
|
16
19
|
|
|
17
20
|
type ToResult = (codePoint: number) => Result
|
|
18
21
|
|
|
19
22
|
type CreateToResult<T> = (state: T) => ToResult
|
|
20
23
|
|
|
21
|
-
type State<T> =
|
|
24
|
+
type State<T> = RangeMapArray<CreateToResult<T>>
|
|
22
25
|
|
|
23
26
|
const unexpectedSymbol
|
|
24
27
|
: ToResult
|
|
@@ -42,8 +45,8 @@ const empty
|
|
|
42
45
|
|
|
43
46
|
const reduce = <T>(a: list.List<State<T>>): State<T> => {
|
|
44
47
|
const merge
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
: RangeMerge<CreateToResult<T>>
|
|
49
|
+
= rangeMapMerge({
|
|
47
50
|
union,
|
|
48
51
|
equal: operator.strictEqual,
|
|
49
52
|
})
|
|
@@ -55,13 +58,16 @@ const codePointRange = fromRange(def)
|
|
|
55
58
|
const range = fn(asciiRange).then(codePointRange).result
|
|
56
59
|
|
|
57
60
|
const rangeSet
|
|
58
|
-
|
|
61
|
+
= (l: readonly string[]) => <T>(f: CreateToResult<T>): State<T> => {
|
|
62
|
+
|
|
59
63
|
const codePointRange
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
: (a: Range) => (f: CreateToResult<T>) => State<T>
|
|
65
|
+
= fromRange(def)
|
|
66
|
+
|
|
62
67
|
const g
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
: (r: string) => State<T>
|
|
69
|
+
= r => codePointRange(asciiRange(r))(f)
|
|
70
|
+
|
|
65
71
|
return reduce(map(g)(l))
|
|
66
72
|
}
|
|
67
73
|
|
package/html/module.f.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import * as s from '../types/string/module.f.ts'
|
|
4
|
-
const { concat: stringConcat } = s
|
|
1
|
+
import { map, flatMap, flat, concat as listConcat, type List } from '../types/list/module.f.ts'
|
|
2
|
+
import { concat as stringConcat } from '../types/string/module.f.ts'
|
|
5
3
|
import * as O from '../types/object/module.f.ts'
|
|
6
|
-
import
|
|
7
|
-
const { compose } = f
|
|
4
|
+
import { compose } from '../types/function/module.f.ts'
|
|
8
5
|
import * as utf16 from '../text/utf16/module.f.ts'
|
|
9
6
|
const { stringToList } = utf16
|
|
10
7
|
const { fromCharCode } = String
|
|
@@ -72,33 +69,33 @@ const escapeCharCode
|
|
|
72
69
|
const escape = compose(stringToList)(map(escapeCharCode))
|
|
73
70
|
|
|
74
71
|
const node
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
: (n: Node) => List<string>
|
|
73
|
+
= n => typeof n === 'string' ? escape(n) : element(n)
|
|
77
74
|
|
|
78
75
|
const nodes = flatMap(node)
|
|
79
76
|
|
|
80
77
|
const attribute
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
: (a: O.Entry<string>) => List<string>
|
|
79
|
+
= ([name, value]) => flat([[' ', name, '="'], escape(value), ['"']])
|
|
83
80
|
|
|
84
81
|
const attributes
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
: (a: Attributes) => List<string>
|
|
83
|
+
= compose(entries)(flatMap(attribute))
|
|
87
84
|
|
|
88
85
|
const open
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
: (t: string) => (a: Attributes) => List<string>
|
|
87
|
+
= t => a => flat([[`<`, t], attributes(a), [`>`]])
|
|
91
88
|
|
|
92
89
|
const element3
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
: (t: string) => (an: readonly[Attributes, readonly Node[]]) => List<string>
|
|
91
|
+
= t => ([a, n]) => {
|
|
95
92
|
const o = flat([[`<`, t], attributes(a), [`>`]])
|
|
96
93
|
return isVoid(t) ? o : flat([o, nodes(n), ['</', t, '>']])
|
|
97
94
|
}
|
|
98
95
|
|
|
99
96
|
export const element
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
: (element: Element) => List<string>
|
|
98
|
+
= e => {
|
|
102
99
|
const [t, a, ...n] = e
|
|
103
100
|
return element3(t)(a === undefined ? [{}, []]: typeof a === 'object' && !(a instanceof Array) ? [a, n] : [{}, [a, ...n]])
|
|
104
101
|
}
|
package/package.json
CHANGED
package/text/utf16/module.f.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
map,
|
|
3
|
+
flat,
|
|
4
|
+
stateScan,
|
|
5
|
+
reduce,
|
|
6
|
+
flatMap,
|
|
7
|
+
empty,
|
|
8
|
+
type List,
|
|
9
|
+
type Result,
|
|
10
|
+
} from '../../types/list/module.f.ts'
|
|
2
11
|
import * as operator from '../../types/function/operator/module.f.ts'
|
|
3
|
-
import
|
|
4
|
-
const { contains } = range
|
|
12
|
+
import { contains } from '../../types/range/module.f.ts'
|
|
5
13
|
import * as f from '../../types/function/module.f.ts'
|
|
6
14
|
const { fn } = f
|
|
7
|
-
const { map, flat, stateScan, reduce, flatMap, empty } = list
|
|
8
15
|
|
|
9
16
|
type WordOrEof = u16|null
|
|
10
17
|
|
|
@@ -36,8 +43,8 @@ const isSupplementaryPlane
|
|
|
36
43
|
= contains([0x01_0000, 0x10_ffff])
|
|
37
44
|
|
|
38
45
|
const codePointToUtf16
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
: (input: i32) => List<u16>
|
|
47
|
+
= codePoint => {
|
|
41
48
|
if (isBmpCodePoint(codePoint)) { return [codePoint] }
|
|
42
49
|
if (isSupplementaryPlane(codePoint)) {
|
|
43
50
|
const n = codePoint - 0x1_0000
|
|
@@ -53,8 +60,8 @@ export const fromCodePointList = flatMap(codePointToUtf16)
|
|
|
53
60
|
const u16 = contains([0x0000, 0xFFFF])
|
|
54
61
|
|
|
55
62
|
const utf16ByteToCodePointOp
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
: operator.StateScan<u16, Utf16State, List<i32>>
|
|
64
|
+
= state => word => {
|
|
58
65
|
if (!u16(word)) {
|
|
59
66
|
return [[0xffffffff], state]
|
|
60
67
|
}
|
|
@@ -74,27 +81,27 @@ const utf16ByteToCodePointOp
|
|
|
74
81
|
}
|
|
75
82
|
|
|
76
83
|
const utf16EofToCodePointOp
|
|
77
|
-
|
|
78
|
-
|
|
84
|
+
: (state: Utf16State) => readonly[List<i32>, Utf16State]
|
|
85
|
+
= state => [state === null ? empty : [state | errorMask], null]
|
|
79
86
|
|
|
80
87
|
const utf16ByteOrEofToCodePointOp
|
|
81
|
-
|
|
82
|
-
|
|
88
|
+
: operator.StateScan<WordOrEof, Utf16State, List<i32>>
|
|
89
|
+
= state => input => input === null ? utf16EofToCodePointOp(state) : utf16ByteToCodePointOp(state)(input)
|
|
83
90
|
|
|
84
91
|
const eofList
|
|
85
|
-
|
|
86
|
-
|
|
92
|
+
: List<WordOrEof>
|
|
93
|
+
= [null]
|
|
87
94
|
|
|
88
95
|
export const toCodePointList
|
|
89
|
-
|
|
90
|
-
|
|
96
|
+
: (input: List<u16>) => List<i32>
|
|
97
|
+
= input => flat(stateScan(utf16ByteOrEofToCodePointOp)(null)(flat([input, eofList])))
|
|
91
98
|
|
|
92
99
|
export const stringToList
|
|
93
|
-
|
|
94
|
-
|
|
100
|
+
: (s: string) => List<u16>
|
|
101
|
+
= s => {
|
|
95
102
|
const at
|
|
96
|
-
|
|
97
|
-
|
|
103
|
+
: (i: number) => Result<number>
|
|
104
|
+
= i => {
|
|
98
105
|
const first = s.charCodeAt(i)
|
|
99
106
|
return isNaN(first) ? empty : { first, tail: () => at(i + 1) }
|
|
100
107
|
}
|
|
@@ -102,7 +109,7 @@ export const stringToList
|
|
|
102
109
|
}
|
|
103
110
|
|
|
104
111
|
export const listToString
|
|
105
|
-
|
|
106
|
-
|
|
112
|
+
: (input: List<u16>) => string
|
|
113
|
+
= fn(map(String.fromCharCode))
|
|
107
114
|
.then(reduce(operator.concat)(''))
|
|
108
115
|
.result
|
package/text/utf8/module.f.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { flatMap, flat, stateScan, type List } 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
|
-
const { flatMap, flat, stateScan } = list
|
|
5
4
|
|
|
6
5
|
type ByteOrEof = u8|null
|
|
7
6
|
|
|
@@ -16,7 +15,7 @@ type i32 = number
|
|
|
16
15
|
const errorMask = 0b1000_0000_0000_0000_0000_0000_0000_0000
|
|
17
16
|
|
|
18
17
|
const codePointToUtf8
|
|
19
|
-
: (input:number) =>
|
|
18
|
+
: (input:number) => List<u8>
|
|
20
19
|
= input => {
|
|
21
20
|
if (input >= 0x0000 && input <= 0x007f) { return [input & 0b01111_1111] }
|
|
22
21
|
if (input >= 0x0080 && input <= 0x07ff) { return [input >> 6 | 0b1100_0000, input & 0b0011_1111 | 0b1000_0000] }
|
|
@@ -61,7 +60,7 @@ const utf8StateToError
|
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
const utf8ByteToCodePointOp
|
|
64
|
-
: operator.StateScan<number, Utf8State,
|
|
63
|
+
: operator.StateScan<number, Utf8State, List<i32>>
|
|
65
64
|
= state => byte => {
|
|
66
65
|
if (byte < 0x00 || byte > 0xff) {
|
|
67
66
|
return [[errorMask], state]
|
|
@@ -98,18 +97,18 @@ const utf8ByteToCodePointOp
|
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
const utf8EofToCodePointOp
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
: (state: Utf8State) => readonly[List<i32>, Utf8State]
|
|
101
|
+
= state =>
|
|
103
102
|
[state === null ? null : [utf8StateToError(state)], null]
|
|
104
103
|
|
|
105
104
|
const utf8ByteOrEofToCodePointOp
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
: operator.StateScan<ByteOrEof, Utf8State, List<i32>>
|
|
106
|
+
= state => input => input === null ? utf8EofToCodePointOp(state) : utf8ByteToCodePointOp(state)(input)
|
|
108
107
|
|
|
109
108
|
const eofList
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
: List<ByteOrEof>
|
|
110
|
+
= [null]
|
|
112
111
|
|
|
113
112
|
export const toCodePointList
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
: (input: List<u8>) => List<i32>
|
|
114
|
+
= input => flat(stateScan(utf8ByteOrEofToCodePointOp)(null)(flat([input, eofList])))
|
package/types/bigint/module.f.ts
CHANGED
|
@@ -1,8 +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
|
|
5
|
-
const { reduce } = list
|
|
4
|
+
import { reduce } from '../list/module.f.ts'
|
|
6
5
|
|
|
7
6
|
type Unary = Operator.Unary<bigint, bigint>
|
|
8
7
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const { compose } = f
|
|
1
|
+
import { compose } from '../function/module.f.ts'
|
|
3
2
|
import * as RangeMap from '../range_map/module.f.ts'
|
|
4
3
|
import * as SortedSet from '../sorted_set/module.f.ts'
|
|
5
4
|
import * as list from '../list/module.f.ts'
|
package/types/list/module.f.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import * as operator from '../function/operator/module.f.ts'
|
|
4
|
-
const {
|
|
1
|
+
import { identity, fn, compose } from '../function/module.f.ts'
|
|
2
|
+
import {
|
|
5
3
|
addition,
|
|
6
4
|
logicalNot,
|
|
7
5
|
strictEqual,
|
|
8
6
|
stateScanToScan,
|
|
9
7
|
foldToScan,
|
|
10
|
-
reduceToScan
|
|
11
|
-
|
|
8
|
+
reduceToScan,
|
|
9
|
+
type Scan,
|
|
10
|
+
type StateScan,
|
|
11
|
+
type Fold,
|
|
12
|
+
type Reduce,
|
|
13
|
+
type Equal,
|
|
14
|
+
} from '../function/operator/module.f.ts'
|
|
12
15
|
|
|
13
16
|
export type List<T> = NotLazy<T> | Thunk<T>
|
|
14
17
|
|
|
@@ -248,30 +251,30 @@ export const cycle
|
|
|
248
251
|
}
|
|
249
252
|
|
|
250
253
|
const scanStep
|
|
251
|
-
: <I, O>(op:
|
|
254
|
+
: <I, O>(op: Scan<I, O>) => (ne: NonEmpty<I>) => List<O>
|
|
252
255
|
= op => ne => {
|
|
253
256
|
const [first, newOp] = op(ne.first)
|
|
254
257
|
return { first, tail: scan(newOp)(ne.tail) }
|
|
255
258
|
}
|
|
256
259
|
|
|
257
260
|
export const scan
|
|
258
|
-
: <I, O>(op:
|
|
261
|
+
: <I, O>(op: Scan<I, O>) => (input: List<I>) => Thunk<O>
|
|
259
262
|
= op => apply(scanStep(op))
|
|
260
263
|
|
|
261
264
|
export const stateScan
|
|
262
|
-
: <I, S, O>(op:
|
|
265
|
+
: <I, S, O>(op: StateScan<I, S, O>) => (init: S) => (input: List<I>) => Thunk<O>
|
|
263
266
|
= op => compose(stateScanToScan(op))(scan)
|
|
264
267
|
|
|
265
268
|
export const foldScan
|
|
266
|
-
: <I,O>(op:
|
|
269
|
+
: <I,O>(op: Fold<I, O>) => (init: O) => (input: List<I>) => Thunk<O>
|
|
267
270
|
= op => compose(foldToScan(op))(scan)
|
|
268
271
|
|
|
269
272
|
export const fold
|
|
270
|
-
: <I,O>(op:
|
|
273
|
+
: <I,O>(op: Fold<I, O>) => (init: O) => (input: List<I>) => O
|
|
271
274
|
= op => init => compose(foldScan(op)(init))(last(init))
|
|
272
275
|
|
|
273
276
|
export const reduce
|
|
274
|
-
: <T>(op:
|
|
277
|
+
: <T>(op: Reduce<T>) => <D>(def: D) => (input: List<T>) => D|T
|
|
275
278
|
= op => def => compose(scan(reduceToScan(op)))(last(def))
|
|
276
279
|
|
|
277
280
|
const lengthList
|
|
@@ -304,7 +307,7 @@ export const entries
|
|
|
304
307
|
= input => {
|
|
305
308
|
type T = typeof input extends List<infer T> ? T : never
|
|
306
309
|
const o
|
|
307
|
-
:
|
|
310
|
+
: StateScan<T, number, Entry<T>>
|
|
308
311
|
= entryOperator
|
|
309
312
|
return stateScan(o)(0)(input)
|
|
310
313
|
}
|
|
@@ -328,9 +331,9 @@ export const zip
|
|
|
328
331
|
}
|
|
329
332
|
|
|
330
333
|
export const equal
|
|
331
|
-
: <T>(e:
|
|
334
|
+
: <T>(e: Equal<T>) => (a: List<T>) => (b: List<T>) => boolean
|
|
332
335
|
= e => {
|
|
333
|
-
type T = typeof e extends
|
|
336
|
+
type T = typeof e extends Equal<infer T> ? T : never
|
|
334
337
|
const f
|
|
335
338
|
: (a: List<T>) => (b: List<T>) => List<boolean>
|
|
336
339
|
= a => b => () => {
|
package/types/number/module.f.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import * as operator from '../function/operator/module.f.ts'
|
|
4
|
-
const { addition, min: minOp, max: maxOp } = operator
|
|
1
|
+
import { reduce } from '../list/module.f.ts'
|
|
2
|
+
import { addition, min as minOp, max as maxOp } from '../function/operator/module.f.ts'
|
|
5
3
|
import * as compare from '../function/compare/module.f.ts'
|
|
6
4
|
const { unsafeCmp } = compare
|
|
7
5
|
|
package/types/string/module.f.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import * as list from '../list/module.f.ts'
|
|
2
2
|
const { reduce: listReduce, repeat: listRepeat } = list
|
|
3
|
-
import
|
|
4
|
-
const { compose } = f
|
|
3
|
+
import { compose } from '../function/module.f.ts'
|
|
5
4
|
import * as compare from '../function/compare/module.f.ts'
|
|
6
5
|
const { unsafeCmp } = compare
|
|
7
|
-
import
|
|
8
|
-
const { join: joinOp, concat: concatOp } = op
|
|
6
|
+
import { join as joinOp, concat as concatOp, type Reduce } from '../function/operator/module.f.ts'
|
|
9
7
|
|
|
10
8
|
const reduce
|
|
11
|
-
: (o:
|
|
9
|
+
: (o: Reduce<string>) => (input: list.List<string>) => string
|
|
12
10
|
= o => listReduce(o)('')
|
|
13
11
|
|
|
14
12
|
export const join = compose(joinOp)(reduce)
|
|
@@ -6,17 +6,15 @@ import * as btr from '../btree/remove/module.f.ts'
|
|
|
6
6
|
const { remove: btreeRemove } = btr
|
|
7
7
|
import * as bts from '../btree/set/module.f.ts'
|
|
8
8
|
const { set: btreeSet } = bts
|
|
9
|
-
export const {
|
|
10
|
-
values,
|
|
11
|
-
empty,
|
|
12
|
-
}: { values: (s: StringSet) => list.List<string>, empty: null } = btree
|
|
13
9
|
import * as string from "../string/module.f.ts"
|
|
14
10
|
const { cmp } = string
|
|
15
|
-
import
|
|
16
|
-
const { fold } = list
|
|
11
|
+
import { fold, type List } from '../list/module.f.ts'
|
|
17
12
|
import * as f from '../function/module.f.ts'
|
|
18
13
|
const { compose } = f
|
|
19
14
|
|
|
15
|
+
export const values: (s: StringSet) => List<string> = btree.values
|
|
16
|
+
export const empty: null = btree.empty
|
|
17
|
+
|
|
20
18
|
export type StringSet = BtreeTypes.Tree<string>
|
|
21
19
|
|
|
22
20
|
export const contains
|