functionalscript 0.2.6 → 0.3.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/.github/workflows/ci.yml +19 -4
- package/CHANGELOG.md +5 -0
- package/com/cpp/{module.f.mjs → module.f.ts} +65 -44
- package/com/cpp/{test.f.mjs → test.f.ts} +1 -1
- package/com/cpp/testlib.f.ts +8 -0
- package/com/cs/{module.f.mjs → module.f.ts} +47 -38
- package/com/cs/{test.f.mjs → test.f.ts} +2 -2
- package/com/cs/testlib.f.ts +8 -0
- package/com/rust/module.f.ts +287 -0
- package/com/rust/{test.f.mjs → test.f.ts} +1 -1
- package/com/rust/testlib.f.ts +8 -0
- package/com/test/{build.f.mjs → build.f.ts} +47 -45
- package/com/test/{build.mjs → build.ts} +7 -6
- package/com/types/module.f.ts +62 -0
- package/com/types/{testlib.f.mjs → testlib.f.ts} +2 -3
- package/commonjs/build/module.f.ts +100 -0
- package/commonjs/build/{test.f.mjs → test.f.ts} +21 -17
- package/commonjs/module/function/module.f.ts +13 -0
- package/commonjs/module/module.f.ts +41 -0
- package/commonjs/module.f.ts +7 -0
- package/commonjs/{module.mjs → module.ts} +12 -9
- package/commonjs/package/dependencies/module.f.ts +22 -0
- package/commonjs/package/dependencies/{test.f.mjs → test.f.ts} +1 -1
- package/commonjs/package/module.f.ts +31 -0
- package/commonjs/package/{test.f.mjs → test.f.ts} +1 -1
- package/commonjs/path/{module.f.mjs → module.f.ts} +72 -67
- package/commonjs/path/{test.f.mjs → test.f.ts} +25 -19
- package/commonjs/{test.mjs → test.ts} +5 -4
- package/crypto/prime_field/{module.f.mjs → module.f.ts} +40 -37
- package/crypto/prime_field/{test.f.mjs → test.f.ts} +7 -5
- package/crypto/secp/{module.f.mjs → module.f.ts} +44 -44
- package/crypto/secp/{test.f.mjs → test.f.ts} +16 -11
- package/crypto/sha2/{module.f.mjs → module.f.ts} +61 -46
- package/crypto/sha2/{test.f.mjs → test.f.ts} +12 -9
- package/deno.json +71 -0
- package/dev/README.md +8 -0
- package/dev/index.ts +3 -0
- package/dev/{module.f.mjs → module.f.ts} +0 -2
- package/dev/{module.mjs → module.ts} +65 -60
- package/dev/test/{module.f.mjs → module.f.ts} +57 -70
- package/dev/{test.f.mjs → test.f.ts} +7 -5
- package/dev/test.ts +53 -0
- package/djs/{module.f.mjs → module.f.ts} +31 -31
- package/djs/parser/{module.f.mjs → module.f.ts} +190 -182
- package/djs/parser/{test.f.mjs → test.f.ts} +173 -150
- package/djs/serializer/module.f.ts +90 -0
- package/djs/{test.f.mjs → test.f.ts} +4 -4
- package/djs/tokenizer/{module.f.mjs → module.f.ts} +35 -42
- package/djs/tokenizer/{test.f.mjs → test.f.ts} +9 -8
- package/fsc/{module.f.mjs → module.f.ts} +41 -44
- package/fsc/{test.f.mjs → test.f.ts} +8 -6
- package/fsm/module.f.ts +107 -0
- package/fsm/{test.f.mjs → test.f.ts} +10 -9
- package/html/module.f.ts +108 -0
- package/html/{test.f.mjs → test.f.ts} +10 -7
- package/issues/lang/3110-function.md +25 -1
- package/issues/{test.f.mjs → test.f.ts} +3 -2
- package/js/tokenizer/module.f.ts +882 -0
- package/js/tokenizer/{test.f.mjs → test.f.ts} +11 -10
- package/json/module.f.ts +94 -0
- package/json/parser/{module.f.mjs → module.f.ts} +113 -109
- package/json/parser/{test.f.mjs → test.f.ts} +10 -9
- package/json/serializer/module.f.ts +70 -0
- package/json/serializer/{test.f.mjs → test.f.ts} +3 -3
- package/json/{test.f.mjs → test.f.ts} +3 -3
- package/json/tokenizer/{module.f.mjs → module.f.ts} +29 -36
- package/json/tokenizer/{test.f.mjs → test.f.ts} +9 -8
- package/nanvm-lib/src/extension.rs +15 -4
- package/nanvm-lib/src/interface.rs +7 -10
- package/nanvm-lib/src/lib.rs +3 -3
- package/nanvm-lib/src/naive.rs +10 -3
- package/nanvm-lib/src/nanenum.rs +5 -1
- package/nanvm-lib/tests/{test.f.mjs → test.f.ts} +7 -6
- package/nodejs/version/{main.mjs → main.ts} +1 -1
- package/nodejs/version/module.f.ts +42 -0
- package/nodejs/version/{test.f.mjs → test.f.ts} +11 -12
- package/package.json +9 -9
- package/text/ascii/{module.f.mjs → module.f.ts} +10 -8
- package/text/ascii/{test.f.mjs → test.f.ts} +4 -4
- package/text/module.f.ts +30 -0
- package/text/sgr/{module.f.mjs → module.f.ts} +3 -5
- package/text/{test.f.mjs → test.f.ts} +5 -4
- package/text/utf16/module.f.ts +108 -0
- package/text/utf16/{test.f.mjs → test.f.ts} +7 -6
- package/text/utf8/{module.f.mjs → module.f.ts} +29 -23
- package/text/utf8/{test.f.mjs → test.f.ts} +4 -4
- package/tsconfig.json +4 -1
- package/types/array/module.f.ts +89 -0
- package/types/array/{test.f.mjs → test.f.ts} +3 -3
- package/types/bigfloat/{module.f.mjs → module.f.ts} +25 -20
- package/types/bigfloat/{test.f.mjs → test.f.ts} +1 -1
- package/types/bigint/{module.f.mjs → module.f.ts} +29 -28
- package/types/bigint/{test.f.mjs → test.f.ts} +2 -2
- package/types/bit_vec/{module.f.mjs → module.f.ts} +16 -37
- package/types/bit_vec/{test.f.mjs → test.f.ts} +1 -1
- package/types/btree/find/module.f.ts +92 -0
- package/types/btree/find/{test.f.mjs → test.f.ts} +20 -16
- package/types/btree/{module.f.mjs → module.f.ts} +9 -9
- package/types/btree/remove/{module.f.mjs → module.f.ts} +43 -53
- package/types/btree/remove/{test.f.mjs → test.f.ts} +19 -15
- package/types/btree/set/{module.f.mjs → module.f.ts} +17 -20
- package/types/btree/set/{test.f.mjs → test.f.ts} +96 -66
- package/types/btree/{test.f.mjs → test.f.ts} +34 -26
- package/types/btree/types/module.f.ts +27 -0
- package/types/byte_set/module.f.ts +70 -0
- package/types/byte_set/{test.f.mjs → test.f.ts} +8 -7
- package/types/function/compare/module.f.ts +26 -0
- package/types/function/compare/{test.f.mjs → test.f.ts} +1 -1
- package/types/function/module.f.ts +43 -0
- package/types/function/operator/module.f.ts +63 -0
- package/types/function/test.f.ts +20 -0
- package/types/list/module.f.ts +345 -0
- package/types/list/{test.f.mjs → test.f.ts} +30 -24
- package/types/map/module.f.ts +65 -0
- package/types/map/{test.f.mjs → test.f.ts} +6 -5
- package/types/nibble_set/module.f.ts +34 -0
- package/types/nibble_set/{test.f.mjs → test.f.ts} +3 -3
- package/types/nullable/module.f.ts +9 -0
- package/types/nullable/{test.f.mjs → test.f.ts} +2 -2
- package/types/number/module.f.ts +16 -0
- package/types/number/{test.f.mjs → test.f.ts} +7 -5
- package/types/object/module.f.ts +30 -0
- package/types/object/{test.f.mjs → test.f.ts} +2 -2
- package/types/range/module.f.ts +10 -0
- package/types/range/{test.f.mjs → test.f.ts} +1 -1
- package/types/range_map/module.f.ts +70 -0
- package/types/range_map/{test.f.mjs → test.f.ts} +82 -57
- package/types/result/module.f.ts +20 -0
- package/types/result/{module.mjs → module.ts} +4 -3
- package/types/sorted_list/module.f.ts +83 -0
- package/types/sorted_list/{test.f.mjs → test.f.ts} +14 -12
- package/types/sorted_set/module.f.ts +36 -0
- package/types/sorted_set/{test.f.mjs → test.f.ts} +14 -12
- package/types/string/module.f.ts +24 -0
- package/types/string/{test.f.mjs → test.f.ts} +2 -2
- package/types/string_set/module.f.ts +37 -0
- package/types/string_set/{test.f.mjs → test.f.ts} +2 -2
- package/com/cpp/testlib.f.mjs +0 -8
- package/com/cs/testlib.f.mjs +0 -8
- package/com/rust/module.f.mjs +0 -272
- package/com/rust/testlib.f.mjs +0 -8
- package/com/types/module.f.mjs +0 -67
- package/commonjs/build/module.f.mjs +0 -100
- package/commonjs/module/function/module.f.mjs +0 -21
- package/commonjs/module/module.f.mjs +0 -53
- package/commonjs/module.f.mjs +0 -11
- package/commonjs/package/dependencies/module.f.mjs +0 -22
- package/commonjs/package/module.f.mjs +0 -36
- package/dev/index.mjs +0 -3
- package/dev/test.mjs +0 -60
- package/fsm/module.f.mjs +0 -99
- package/html/module.f.mjs +0 -102
- package/js/tokenizer/module.f.mjs +0 -872
- package/json/module.f.mjs +0 -89
- package/json/serializer/module.f.mjs +0 -87
- package/jsr.json +0 -66
- package/nodejs/version/module.f.mjs +0 -47
- package/out/com/cpp/module.f.d.mts +0 -7
- package/out/com/cpp/module.f.mjs +0 -130
- package/out/com/cpp/test.f.d.mts +0 -2
- package/out/com/cpp/test.f.mjs +0 -40
- package/out/com/cpp/testlib.f.d.mts +0 -2
- package/out/com/cpp/testlib.f.mjs +0 -7
- package/out/com/cs/module.f.d.mts +0 -7
- package/out/com/cs/module.f.mjs +0 -104
- package/out/com/cs/test.f.d.mts +0 -2
- package/out/com/cs/test.f.mjs +0 -43
- package/out/com/cs/testlib.f.d.mts +0 -2
- package/out/com/cs/testlib.f.mjs +0 -7
- package/out/com/rust/module.f.d.mts +0 -23
- package/out/com/rust/module.f.mjs +0 -224
- package/out/com/rust/test.f.d.mts +0 -2
- package/out/com/rust/test.f.mjs +0 -123
- package/out/com/rust/testlib.f.d.mts +0 -2
- package/out/com/rust/testlib.f.mjs +0 -7
- package/out/com/test/build.d.mts +0 -1
- package/out/com/test/build.f.d.mts +0 -26
- package/out/com/test/build.f.mjs +0 -98
- package/out/com/test/build.mjs +0 -40
- package/out/com/types/module.f.d.mts +0 -23
- package/out/com/types/module.f.mjs +0 -51
- package/out/com/types/testlib.f.d.mts +0 -44
- package/out/com/types/testlib.f.mjs +0 -30
- package/out/commonjs/build/module.f.d.mts +0 -20
- package/out/commonjs/build/module.f.mjs +0 -107
- package/out/commonjs/build/test.f.d.mts +0 -3
- package/out/commonjs/build/test.f.mjs +0 -102
- package/out/commonjs/module/function/module.f.d.mts +0 -5
- package/out/commonjs/module/function/module.f.mjs +0 -15
- package/out/commonjs/module/module.f.d.mts +0 -52
- package/out/commonjs/module/module.f.mjs +0 -48
- package/out/commonjs/module.d.mts +0 -3
- package/out/commonjs/module.f.d.mts +0 -2
- package/out/commonjs/module.f.mjs +0 -10
- package/out/commonjs/module.mjs +0 -26
- package/out/commonjs/package/dependencies/module.f.d.mts +0 -6
- package/out/commonjs/package/dependencies/module.f.mjs +0 -21
- package/out/commonjs/package/dependencies/test.f.d.mts +0 -2
- package/out/commonjs/package/dependencies/test.f.mjs +0 -15
- package/out/commonjs/package/module.f.d.mts +0 -21
- package/out/commonjs/package/module.f.mjs +0 -40
- package/out/commonjs/package/test.f.d.mts +0 -2
- package/out/commonjs/package/test.f.mjs +0 -27
- package/out/commonjs/path/module.f.d.mts +0 -60
- package/out/commonjs/path/module.f.mjs +0 -171
- package/out/commonjs/path/test.f.d.mts +0 -25
- package/out/commonjs/path/test.f.mjs +0 -231
- package/out/commonjs/test.d.mts +0 -8
- package/out/commonjs/test.mjs +0 -87
- package/out/crypto/prime_field/module.f.d.mts +0 -67
- package/out/crypto/prime_field/module.f.mjs +0 -110
- package/out/crypto/prime_field/test.f.d.mts +0 -13
- package/out/crypto/prime_field/test.f.mjs +0 -152
- package/out/crypto/secp/module.f.d.mts +0 -110
- package/out/crypto/secp/module.f.mjs +0 -173
- package/out/crypto/secp/test.f.d.mts +0 -5
- package/out/crypto/secp/test.f.mjs +0 -78
- package/out/crypto/sha2/module.f.d.mts +0 -15
- package/out/crypto/sha2/module.f.mjs +0 -172
- package/out/crypto/sha2/test.f.d.mts +0 -10
- package/out/crypto/sha2/test.f.mjs +0 -86
- package/out/dev/index.d.mts +0 -1
- package/out/dev/index.mjs +0 -2
- package/out/dev/module.d.mts +0 -26
- package/out/dev/module.f.d.mts +0 -1
- package/out/dev/module.f.mjs +0 -2
- package/out/dev/module.mjs +0 -167
- package/out/dev/test/module.f.d.mts +0 -25
- package/out/dev/test/module.f.mjs +0 -134
- package/out/dev/test.d.mts +0 -3
- package/out/dev/test.f.d.mts +0 -9
- package/out/dev/test.f.mjs +0 -58
- package/out/dev/test.mjs +0 -52
- package/out/djs/module.f.d.mts +0 -20
- package/out/djs/module.f.mjs +0 -79
- package/out/djs/parser/module.f.d.mts +0 -56
- package/out/djs/parser/module.f.mjs +0 -448
- package/out/djs/parser/test.f.d.mts +0 -13
- package/out/djs/parser/test.f.mjs +0 -569
- package/out/djs/test.f.d.mts +0 -12
- package/out/djs/test.f.mjs +0 -84
- package/out/djs/tokenizer/module.f.d.mts +0 -13
- package/out/djs/tokenizer/module.f.mjs +0 -91
- package/out/djs/tokenizer/test.f.d.mts +0 -7
- package/out/djs/tokenizer/test.f.mjs +0 -530
- package/out/fsc/module.f.d.mts +0 -7
- package/out/fsc/module.f.mjs +0 -105
- package/out/fsc/test.f.d.mts +0 -4
- package/out/fsc/test.f.mjs +0 -19
- package/out/fsm/module.f.d.mts +0 -14
- package/out/fsm/module.f.mjs +0 -80
- package/out/fsm/test.f.d.mts +0 -5
- package/out/fsm/test.f.mjs +0 -138
- package/out/html/module.f.d.mts +0 -17
- package/out/html/module.f.mjs +0 -80
- package/out/html/test.f.d.mts +0 -10
- package/out/html/test.f.mjs +0 -45
- package/out/issues/test.f.d.mts +0 -16
- package/out/issues/test.f.mjs +0 -66
- package/out/js/tokenizer/module.f.d.mts +0 -163
- package/out/js/tokenizer/module.f.mjs +0 -729
- package/out/js/tokenizer/test.f.d.mts +0 -9
- package/out/js/tokenizer/test.f.mjs +0 -906
- package/out/json/module.f.d.mts +0 -33
- package/out/json/module.f.mjs +0 -89
- package/out/json/parser/module.f.d.mts +0 -32
- package/out/json/parser/module.f.mjs +0 -224
- package/out/json/parser/test.f.d.mts +0 -5
- package/out/json/parser/test.f.mjs +0 -329
- package/out/json/serializer/module.f.d.mts +0 -36
- package/out/json/serializer/module.f.mjs +0 -67
- package/out/json/serializer/test.f.d.mts +0 -8
- package/out/json/serializer/test.f.mjs +0 -87
- package/out/json/test.f.d.mts +0 -8
- package/out/json/test.f.mjs +0 -61
- package/out/json/tokenizer/module.f.d.mts +0 -13
- package/out/json/tokenizer/module.f.mjs +0 -78
- package/out/json/tokenizer/test.f.d.mts +0 -6
- package/out/json/tokenizer/test.f.mjs +0 -420
- package/out/nanvm-lib/tests/test.f.d.mts +0 -36
- package/out/nanvm-lib/tests/test.f.mjs +0 -87
- package/out/nodejs/version/main.d.mts +0 -1
- package/out/nodejs/version/main.mjs +0 -3
- package/out/nodejs/version/module.f.d.mts +0 -12
- package/out/nodejs/version/module.f.mjs +0 -34
- package/out/nodejs/version/test.f.d.mts +0 -2
- package/out/nodejs/version/test.f.mjs +0 -97
- package/out/text/ascii/module.f.d.mts +0 -70
- package/out/text/ascii/module.f.mjs +0 -154
- package/out/text/ascii/test.f.d.mts +0 -4
- package/out/text/ascii/test.f.mjs +0 -14
- package/out/text/module.f.d.mts +0 -13
- package/out/text/module.f.mjs +0 -19
- package/out/text/sgr/module.f.d.mts +0 -12
- package/out/text/sgr/module.f.mjs +0 -17
- package/out/text/test.f.d.mts +0 -2
- package/out/text/test.f.mjs +0 -19
- package/out/text/utf16/module.f.d.mts +0 -12
- package/out/text/utf16/module.f.mjs +0 -86
- package/out/text/utf16/test.f.d.mts +0 -6
- package/out/text/utf16/test.f.mjs +0 -145
- package/out/text/utf8/module.f.d.mts +0 -10
- package/out/text/utf8/module.f.mjs +0 -126
- package/out/text/utf8/test.f.d.mts +0 -6
- package/out/text/utf8/test.f.mjs +0 -175
- package/out/types/array/module.f.d.mts +0 -31
- package/out/types/array/module.f.mjs +0 -95
- package/out/types/array/test.f.d.mts +0 -10
- package/out/types/array/test.f.mjs +0 -116
- package/out/types/bigfloat/module.f.d.mts +0 -6
- package/out/types/bigfloat/module.f.mjs +0 -77
- package/out/types/bigfloat/test.f.d.mts +0 -6
- package/out/types/bigfloat/test.f.mjs +0 -349
- package/out/types/bigint/module.f.d.mts +0 -29
- package/out/types/bigint/module.f.mjs +0 -114
- package/out/types/bigint/test.f.d.mts +0 -16
- package/out/types/bigint/test.f.mjs +0 -199
- package/out/types/bit_vec/module.f.d.mts +0 -158
- package/out/types/bit_vec/module.f.mjs +0 -194
- package/out/types/bit_vec/test.f.d.mts +0 -23
- package/out/types/bit_vec/test.f.mjs +0 -210
- package/out/types/btree/find/module.f.d.mts +0 -36
- package/out/types/btree/find/module.f.mjs +0 -137
- package/out/types/btree/find/test.f.d.mts +0 -2
- package/out/types/btree/find/test.f.mjs +0 -156
- package/out/types/btree/module.f.d.mts +0 -5
- package/out/types/btree/module.f.mjs +0 -34
- package/out/types/btree/remove/module.f.d.mts +0 -14
- package/out/types/btree/remove/module.f.mjs +0 -209
- package/out/types/btree/remove/test.f.d.mts +0 -7
- package/out/types/btree/remove/test.f.mjs +0 -638
- package/out/types/btree/set/module.f.d.mts +0 -5
- package/out/types/btree/set/module.f.mjs +0 -114
- package/out/types/btree/set/test.f.d.mts +0 -2
- package/out/types/btree/set/test.f.mjs +0 -390
- package/out/types/btree/test.f.d.mts +0 -13
- package/out/types/btree/test.f.mjs +0 -83
- package/out/types/btree/types/module.f.d.mts +0 -14
- package/out/types/btree/types/module.f.mjs +0 -50
- package/out/types/byte_set/module.f.d.mts +0 -25
- package/out/types/byte_set/module.f.mjs +0 -42
- package/out/types/byte_set/test.f.d.mts +0 -13
- package/out/types/byte_set/test.f.mjs +0 -123
- package/out/types/function/compare/module.f.d.mts +0 -23
- package/out/types/function/compare/module.f.mjs +0 -22
- package/out/types/function/compare/test.f.d.mts +0 -2
- package/out/types/function/compare/test.f.mjs +0 -8
- package/out/types/function/module.f.d.mts +0 -51
- package/out/types/function/module.f.mjs +0 -44
- package/out/types/function/operator/module.f.d.mts +0 -60
- package/out/types/function/operator/module.f.mjs +0 -60
- package/out/types/function/test.f.d.mts +0 -2
- package/out/types/function/test.f.mjs +0 -15
- package/out/types/list/module.f.d.mts +0 -82
- package/out/types/list/module.f.mjs +0 -269
- package/out/types/list/test.f.d.mts +0 -38
- package/out/types/list/test.f.mjs +0 -401
- package/out/types/map/module.f.d.mts +0 -21
- package/out/types/map/module.f.mjs +0 -54
- package/out/types/map/test.f.d.mts +0 -5
- package/out/types/map/test.f.mjs +0 -115
- package/out/types/nibble_set/module.f.d.mts +0 -16
- package/out/types/nibble_set/module.f.mjs +0 -19
- package/out/types/nibble_set/test.f.d.mts +0 -13
- package/out/types/nibble_set/test.f.mjs +0 -90
- package/out/types/nullable/module.f.d.mts +0 -9
- package/out/types/nullable/module.f.mjs +0 -9
- package/out/types/nullable/test.f.d.mts +0 -2
- package/out/types/nullable/test.f.mjs +0 -12
- package/out/types/number/module.f.d.mts +0 -7
- package/out/types/number/module.f.mjs +0 -12
- package/out/types/number/test.f.d.mts +0 -11
- package/out/types/number/test.f.mjs +0 -126
- package/out/types/object/module.f.d.mts +0 -22
- package/out/types/object/module.f.mjs +0 -27
- package/out/types/object/test.f.d.mts +0 -5
- package/out/types/object/test.f.mjs +0 -17
- package/out/types/range/module.f.d.mts +0 -6
- package/out/types/range/module.f.mjs +0 -6
- package/out/types/range/test.f.d.mts +0 -2
- package/out/types/range/test.f.mjs +0 -18
- package/out/types/range_map/module.f.d.mts +0 -19
- package/out/types/range_map/module.f.mjs +0 -84
- package/out/types/range_map/test.f.d.mts +0 -6
- package/out/types/range_map/test.f.mjs +0 -201
- package/out/types/result/module.d.mts +0 -7
- package/out/types/result/module.f.d.mts +0 -22
- package/out/types/result/module.f.mjs +0 -25
- package/out/types/result/module.mjs +0 -16
- package/out/types/sorted_list/module.f.d.mts +0 -53
- package/out/types/sorted_list/module.f.mjs +0 -102
- package/out/types/sorted_list/test.f.d.mts +0 -5
- package/out/types/sorted_list/test.f.mjs +0 -66
- package/out/types/sorted_set/module.f.d.mts +0 -19
- package/out/types/sorted_set/module.f.mjs +0 -29
- package/out/types/sorted_set/test.f.d.mts +0 -6
- package/out/types/sorted_set/test.f.mjs +0 -80
- package/out/types/string/module.f.d.mts +0 -9
- package/out/types/string/module.f.mjs +0 -17
- package/out/types/string/test.f.d.mts +0 -15
- package/out/types/string/test.f.mjs +0 -58
- package/out/types/string_set/module.f.d.mts +0 -13
- package/out/types/string_set/module.f.mjs +0 -29
- package/out/types/string_set/test.f.d.mts +0 -5
- package/out/types/string_set/test.f.mjs +0 -65
- package/text/module.f.mjs +0 -27
- package/text/utf16/module.f.mjs +0 -96
- package/types/array/module.f.mjs +0 -119
- package/types/btree/find/module.f.mjs +0 -125
- package/types/btree/types/module.f.mjs +0 -64
- package/types/byte_set/module.f.mjs +0 -61
- package/types/function/compare/module.f.mjs +0 -29
- package/types/function/module.f.mjs +0 -50
- package/types/function/operator/module.f.mjs +0 -78
- package/types/function/test.f.mjs +0 -17
- package/types/list/module.f.mjs +0 -320
- package/types/map/module.f.mjs +0 -67
- package/types/nibble_set/module.f.mjs +0 -28
- package/types/nullable/module.f.mjs +0 -11
- package/types/number/module.f.mjs +0 -16
- package/types/object/module.f.mjs +0 -33
- package/types/range/module.f.mjs +0 -8
- package/types/range_map/module.f.mjs +0 -84
- package/types/result/module.f.mjs +0 -28
- package/types/sorted_list/module.f.mjs +0 -107
- package/types/sorted_set/module.f.mjs +0 -38
- package/types/string/module.f.mjs +0 -22
- package/types/string_set/module.f.mjs +0 -36
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import * as _ from './module.f.
|
|
2
|
-
import * as BTree from '../types/module.f.
|
|
3
|
-
import * as s from '../../string/module.f.
|
|
1
|
+
import * as _ from './module.f.ts'
|
|
2
|
+
import * as BTree from '../types/module.f.ts'
|
|
3
|
+
import * as s from '../../string/module.f.ts'
|
|
4
4
|
const { cmp } = s
|
|
5
|
-
import * as json from '../../../json/module.f.
|
|
6
|
-
import * as o from '../../object/module.f.
|
|
5
|
+
import * as json from '../../../json/module.f.ts'
|
|
6
|
+
import * as o from '../../object/module.f.ts'
|
|
7
7
|
const { sort } = o
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const set
|
|
10
|
+
: (node: BTree.TNode<string>) => (value: string) => BTree.TNode<string>
|
|
11
|
+
= node => value => _.set(cmp(value))(() => value)(node)
|
|
11
12
|
|
|
12
13
|
const jsonStr = json.stringify(sort)
|
|
13
14
|
|
|
14
15
|
const test = [
|
|
15
16
|
() => {
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
let _map
|
|
18
|
+
: BTree.TNode<string>
|
|
19
|
+
= ['1']
|
|
18
20
|
for (let i = 2; i <= 10; i++)
|
|
19
21
|
_map = set(_map)((i * i).toString())
|
|
20
22
|
const r = jsonStr(_map)
|
|
@@ -22,8 +24,9 @@ const test = [
|
|
|
22
24
|
},
|
|
23
25
|
|
|
24
26
|
() => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
let _map
|
|
28
|
+
: BTree.TNode<string>
|
|
29
|
+
= ['1']
|
|
27
30
|
for (let i = 2; i <= 11; i++)
|
|
28
31
|
_map = set(_map)((i * i).toString())
|
|
29
32
|
const r = jsonStr(_map)
|
|
@@ -31,8 +34,9 @@ const test = [
|
|
|
31
34
|
},
|
|
32
35
|
|
|
33
36
|
() => {
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
let _map
|
|
38
|
+
: BTree.TNode<string>
|
|
39
|
+
= ['1']
|
|
36
40
|
for (let i = 2; i <= 12; i++)
|
|
37
41
|
_map = set(_map)((i * i).toString())
|
|
38
42
|
const r = jsonStr(_map)
|
|
@@ -40,8 +44,9 @@ const test = [
|
|
|
40
44
|
},
|
|
41
45
|
|
|
42
46
|
() => {
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
let _map
|
|
48
|
+
: BTree.TNode<string>
|
|
49
|
+
= ['1']
|
|
45
50
|
for (let i = 2; i <= 13; i++)
|
|
46
51
|
_map = set(_map)((i * i).toString())
|
|
47
52
|
const r = jsonStr(_map)
|
|
@@ -49,8 +54,9 @@ const test = [
|
|
|
49
54
|
},
|
|
50
55
|
|
|
51
56
|
() => {
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
let _map
|
|
58
|
+
: BTree.TNode<string>
|
|
59
|
+
= ['1']
|
|
54
60
|
for (let i = 2; i <= 14; i++)
|
|
55
61
|
_map = set(_map)((i * i).toString())
|
|
56
62
|
const r = jsonStr(_map)
|
|
@@ -58,8 +64,9 @@ const test = [
|
|
|
58
64
|
},
|
|
59
65
|
|
|
60
66
|
() => {
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
let _map
|
|
68
|
+
: BTree.TNode<string>
|
|
69
|
+
= ['1']
|
|
63
70
|
for (let i = 2; i <= 15; i++)
|
|
64
71
|
_map = set(_map)((i * i).toString())
|
|
65
72
|
const r = jsonStr(_map)
|
|
@@ -67,8 +74,9 @@ const test = [
|
|
|
67
74
|
},
|
|
68
75
|
|
|
69
76
|
() => {
|
|
70
|
-
|
|
71
|
-
|
|
77
|
+
let _map
|
|
78
|
+
: BTree.TNode<string>
|
|
79
|
+
= ['1']
|
|
72
80
|
for (let i = 2; i <= 16; i++)
|
|
73
81
|
_map = set(_map)((i * i).toString())
|
|
74
82
|
const r = jsonStr(_map)
|
|
@@ -76,8 +84,9 @@ const test = [
|
|
|
76
84
|
},
|
|
77
85
|
|
|
78
86
|
() => {
|
|
79
|
-
|
|
80
|
-
|
|
87
|
+
let _map
|
|
88
|
+
: BTree.TNode<string>
|
|
89
|
+
= ['1']
|
|
81
90
|
for (let i = 2; i <= 17; i++)
|
|
82
91
|
_map = set(_map)((i * i).toString())
|
|
83
92
|
const r = jsonStr(_map)
|
|
@@ -85,8 +94,9 @@ const test = [
|
|
|
85
94
|
},
|
|
86
95
|
|
|
87
96
|
() => {
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
let _map
|
|
98
|
+
: BTree.TNode<string>
|
|
99
|
+
= ['1']
|
|
90
100
|
for (let i = 2; i <= 18; i++)
|
|
91
101
|
_map = set(_map)((i * i).toString())
|
|
92
102
|
const r = jsonStr(_map)
|
|
@@ -96,8 +106,9 @@ const test = [
|
|
|
96
106
|
},
|
|
97
107
|
|
|
98
108
|
() => {
|
|
99
|
-
|
|
100
|
-
|
|
109
|
+
let _map
|
|
110
|
+
: BTree.TNode<string>
|
|
111
|
+
= ['1']
|
|
101
112
|
for (let i = 2; i <= 19; i++)
|
|
102
113
|
_map = set(_map)((i * i).toString())
|
|
103
114
|
const r = jsonStr(_map)
|
|
@@ -107,8 +118,9 @@ const test = [
|
|
|
107
118
|
},
|
|
108
119
|
|
|
109
120
|
() => {
|
|
110
|
-
|
|
111
|
-
|
|
121
|
+
let _map
|
|
122
|
+
: BTree.TNode<string>
|
|
123
|
+
= ['1']
|
|
112
124
|
for (let i = 2; i <= 20; i++)
|
|
113
125
|
_map = set(_map)((i * i).toString())
|
|
114
126
|
const r = jsonStr(_map)
|
|
@@ -120,8 +132,9 @@ const test = [
|
|
|
120
132
|
},
|
|
121
133
|
|
|
122
134
|
() => {
|
|
123
|
-
|
|
124
|
-
|
|
135
|
+
let _map
|
|
136
|
+
: BTree.TNode<string>
|
|
137
|
+
= ['1']
|
|
125
138
|
for (let i = 2; i <= 21; i++)
|
|
126
139
|
_map = set(_map)((i * i).toString())
|
|
127
140
|
const r = jsonStr(_map)
|
|
@@ -133,8 +146,9 @@ const test = [
|
|
|
133
146
|
},
|
|
134
147
|
|
|
135
148
|
() => {
|
|
136
|
-
|
|
137
|
-
|
|
149
|
+
let _map
|
|
150
|
+
: BTree.TNode<string>
|
|
151
|
+
= ['1']
|
|
138
152
|
for (let i = 2; i <= 22; i++)
|
|
139
153
|
_map = set(_map)((i * i).toString())
|
|
140
154
|
const r = jsonStr(_map)
|
|
@@ -146,8 +160,9 @@ const test = [
|
|
|
146
160
|
},
|
|
147
161
|
|
|
148
162
|
() => {
|
|
149
|
-
|
|
150
|
-
|
|
163
|
+
let _map
|
|
164
|
+
: BTree.TNode<string>
|
|
165
|
+
= ['1']
|
|
151
166
|
for (let i = 2; i <= 23; i++)
|
|
152
167
|
_map = set(_map)((i * i).toString())
|
|
153
168
|
const r = jsonStr(_map)
|
|
@@ -159,8 +174,9 @@ const test = [
|
|
|
159
174
|
},
|
|
160
175
|
|
|
161
176
|
() => {
|
|
162
|
-
|
|
163
|
-
|
|
177
|
+
let _map
|
|
178
|
+
: BTree.TNode<string>
|
|
179
|
+
= ['1']
|
|
164
180
|
for (let i = 2; i <= 24; i++)
|
|
165
181
|
_map = set(_map)((i * i).toString())
|
|
166
182
|
const r = jsonStr(_map)
|
|
@@ -172,8 +188,9 @@ const test = [
|
|
|
172
188
|
},
|
|
173
189
|
|
|
174
190
|
() => {
|
|
175
|
-
|
|
176
|
-
|
|
191
|
+
let _map
|
|
192
|
+
: BTree.TNode<string>
|
|
193
|
+
= ['1']
|
|
177
194
|
for (let i = 2; i <= 25; i++)
|
|
178
195
|
_map = set(_map)((i * i).toString())
|
|
179
196
|
const r = jsonStr(_map)
|
|
@@ -185,8 +202,9 @@ const test = [
|
|
|
185
202
|
},
|
|
186
203
|
|
|
187
204
|
() => {
|
|
188
|
-
|
|
189
|
-
|
|
205
|
+
let _map
|
|
206
|
+
: BTree.TNode<string>
|
|
207
|
+
= ['1']
|
|
190
208
|
for (let i = 2; i <= 26; i++)
|
|
191
209
|
_map = set(_map)((i * i).toString())
|
|
192
210
|
const r = jsonStr(_map)
|
|
@@ -200,8 +218,9 @@ const test = [
|
|
|
200
218
|
},
|
|
201
219
|
|
|
202
220
|
() => {
|
|
203
|
-
|
|
204
|
-
|
|
221
|
+
let _map
|
|
222
|
+
: BTree.TNode<string>
|
|
223
|
+
= ['1']
|
|
205
224
|
for (let i = 2; i <= 27; i++)
|
|
206
225
|
_map = set(_map)((i * i).toString())
|
|
207
226
|
const r = jsonStr(_map)
|
|
@@ -215,8 +234,9 @@ const test = [
|
|
|
215
234
|
},
|
|
216
235
|
|
|
217
236
|
() => {
|
|
218
|
-
|
|
219
|
-
|
|
237
|
+
let _map
|
|
238
|
+
: BTree.TNode<string>
|
|
239
|
+
= ['1']
|
|
220
240
|
for (let i = 2; i <= 28; i++)
|
|
221
241
|
_map = set(_map)((i * i).toString())
|
|
222
242
|
const r = jsonStr(_map)
|
|
@@ -230,8 +250,9 @@ const test = [
|
|
|
230
250
|
},
|
|
231
251
|
|
|
232
252
|
() => {
|
|
233
|
-
|
|
234
|
-
|
|
253
|
+
let _map
|
|
254
|
+
: BTree.TNode<string>
|
|
255
|
+
= ['1']
|
|
235
256
|
for (let i = 2; i <= 29; i++)
|
|
236
257
|
_map = set(_map)((i * i).toString())
|
|
237
258
|
const r = jsonStr(_map)
|
|
@@ -245,8 +266,9 @@ const test = [
|
|
|
245
266
|
},
|
|
246
267
|
|
|
247
268
|
() => {
|
|
248
|
-
|
|
249
|
-
|
|
269
|
+
let _map
|
|
270
|
+
: BTree.TNode<string>
|
|
271
|
+
= ['1']
|
|
250
272
|
for (let i = 2; i <= 30; i++)
|
|
251
273
|
_map = set(_map)((i * i).toString())
|
|
252
274
|
const r = jsonStr(_map)
|
|
@@ -260,8 +282,9 @@ const test = [
|
|
|
260
282
|
},
|
|
261
283
|
|
|
262
284
|
() => {
|
|
263
|
-
|
|
264
|
-
|
|
285
|
+
let _map
|
|
286
|
+
: BTree.TNode<string>
|
|
287
|
+
= ['1']
|
|
265
288
|
for (let i = 2; i <= 31; i++)
|
|
266
289
|
_map = set(_map)((i * i).toString())
|
|
267
290
|
const r = jsonStr(_map)
|
|
@@ -275,8 +298,9 @@ const test = [
|
|
|
275
298
|
},
|
|
276
299
|
|
|
277
300
|
() => {
|
|
278
|
-
|
|
279
|
-
|
|
301
|
+
let _map
|
|
302
|
+
: BTree.TNode<string>
|
|
303
|
+
= ['1']
|
|
280
304
|
for (let i = 2; i <= 32; i++)
|
|
281
305
|
_map = set(_map)((i * i).toString())
|
|
282
306
|
const r = jsonStr(_map)
|
|
@@ -290,8 +314,9 @@ const test = [
|
|
|
290
314
|
},
|
|
291
315
|
|
|
292
316
|
() => {
|
|
293
|
-
|
|
294
|
-
|
|
317
|
+
let _map
|
|
318
|
+
: BTree.TNode<string>
|
|
319
|
+
= ['1']
|
|
295
320
|
for (let i = 2; i <= 33; i++)
|
|
296
321
|
_map = set(_map)((i * i).toString())
|
|
297
322
|
const r = jsonStr(_map)
|
|
@@ -305,8 +330,9 @@ const test = [
|
|
|
305
330
|
},
|
|
306
331
|
|
|
307
332
|
() => {
|
|
308
|
-
|
|
309
|
-
|
|
333
|
+
let _map
|
|
334
|
+
: BTree.TNode<string>
|
|
335
|
+
= ['1']
|
|
310
336
|
for (let i = 2; i <= 34; i++)
|
|
311
337
|
_map = set(_map)((i * i).toString())
|
|
312
338
|
const r = jsonStr(_map)
|
|
@@ -320,8 +346,9 @@ const test = [
|
|
|
320
346
|
},
|
|
321
347
|
|
|
322
348
|
() => {
|
|
323
|
-
|
|
324
|
-
|
|
349
|
+
let _map
|
|
350
|
+
: BTree.TNode<string>
|
|
351
|
+
= ['1']
|
|
325
352
|
for (let i = 2; i <= 35; i++)
|
|
326
353
|
_map = set(_map)((i * i).toString())
|
|
327
354
|
const r = jsonStr(_map)
|
|
@@ -335,8 +362,9 @@ const test = [
|
|
|
335
362
|
},
|
|
336
363
|
|
|
337
364
|
() => {
|
|
338
|
-
|
|
339
|
-
|
|
365
|
+
let _map
|
|
366
|
+
: BTree.TNode<string>
|
|
367
|
+
= ['1']
|
|
340
368
|
for (let i = 2; i <= 36; i++)
|
|
341
369
|
_map = set(_map)((i * i).toString())
|
|
342
370
|
const r = jsonStr(_map)
|
|
@@ -350,8 +378,9 @@ const test = [
|
|
|
350
378
|
},
|
|
351
379
|
|
|
352
380
|
() => {
|
|
353
|
-
|
|
354
|
-
|
|
381
|
+
let _map
|
|
382
|
+
: BTree.TNode<string>
|
|
383
|
+
= ['1']
|
|
355
384
|
for (let i = 2; i <= 37; i++)
|
|
356
385
|
_map = set(_map)((i * i).toString())
|
|
357
386
|
const r = jsonStr(_map)
|
|
@@ -365,8 +394,9 @@ const test = [
|
|
|
365
394
|
},
|
|
366
395
|
|
|
367
396
|
() => {
|
|
368
|
-
|
|
369
|
-
|
|
397
|
+
let _map
|
|
398
|
+
: BTree.TNode<string>
|
|
399
|
+
= ['1']
|
|
370
400
|
for (let i = 2; i <= 38; i++)
|
|
371
401
|
_map = set(_map)((i * i).toString())
|
|
372
402
|
const r = jsonStr(_map)
|
|
@@ -382,4 +412,4 @@ const test = [
|
|
|
382
412
|
}
|
|
383
413
|
]
|
|
384
414
|
|
|
385
|
-
export default test
|
|
415
|
+
export default test
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import * as BTree from './types/module.f.
|
|
2
|
-
import * as _ from './module.f.
|
|
1
|
+
import * as BTree from './types/module.f.ts'
|
|
2
|
+
import * as _ from './module.f.ts'
|
|
3
3
|
const { values } = _
|
|
4
|
-
import * as json from '../../json/module.f.
|
|
5
|
-
import * as o from '../object/module.f.
|
|
4
|
+
import * as json from '../../json/module.f.ts'
|
|
5
|
+
import * as o from '../object/module.f.ts'
|
|
6
6
|
const { sort } = o
|
|
7
|
-
import * as str from '../string/module.f.
|
|
7
|
+
import * as str from '../string/module.f.ts'
|
|
8
8
|
const { cmp } = str
|
|
9
|
-
import * as list from '../list/module.f.
|
|
10
|
-
import * as s from './set/module.f.
|
|
11
|
-
import * as f from './find/module.f.
|
|
9
|
+
import * as list from '../list/module.f.ts'
|
|
10
|
+
import * as s from './set/module.f.ts'
|
|
11
|
+
import * as f from './find/module.f.ts'
|
|
12
12
|
|
|
13
13
|
const jsonStr = json.stringify(sort)
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const stringify
|
|
16
|
+
: (sequence: list.List<json.Unknown>) => string
|
|
17
|
+
= sequence => jsonStr(list.toArray(sequence))
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const set
|
|
20
|
+
: (node: BTree.TNode<string>) => (value: string) => BTree.TNode<string>
|
|
21
|
+
= node => value => s.set(cmp(value))(() => value)(node)
|
|
20
22
|
|
|
21
|
-
const valueTest1 =
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const valueTest1 =() => {
|
|
24
|
+
let _map
|
|
25
|
+
: BTree.TNode<string>
|
|
26
|
+
= ['a']
|
|
24
27
|
_map = set(_map)('b')
|
|
25
28
|
_map = set(_map)('c')
|
|
26
29
|
_map = set(_map)('d')
|
|
@@ -31,8 +34,9 @@ const valueTest1 = () => {
|
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
const valuesTest2 = () => {
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
let _map
|
|
38
|
+
: BTree.TNode<string>
|
|
39
|
+
= ['1']
|
|
36
40
|
for(let i = 2; i <= 10; i++)
|
|
37
41
|
_map = set(_map)((i*i).toString())
|
|
38
42
|
let result = stringify(values(_map))
|
|
@@ -40,8 +44,9 @@ const valuesTest2 = () => {
|
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
const findTrue = () => {
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
let _map
|
|
48
|
+
: BTree.TNode<string>
|
|
49
|
+
= ['a']
|
|
45
50
|
_map = set(_map)('b')
|
|
46
51
|
_map = set(_map)('c')
|
|
47
52
|
const result = f.value(f.find(cmp('b'))(_map).first)
|
|
@@ -49,8 +54,9 @@ const findTrue = () => {
|
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
const find = () => {
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
let _map
|
|
58
|
+
: BTree.TNode<string>
|
|
59
|
+
= ['a']
|
|
54
60
|
_map = set(_map)('b')
|
|
55
61
|
_map = set(_map)('c')
|
|
56
62
|
const result = f.value(f.find(cmp('e'))(_map).first)
|
|
@@ -58,8 +64,9 @@ const find = () => {
|
|
|
58
64
|
}
|
|
59
65
|
|
|
60
66
|
const test = () => {
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
let _map
|
|
68
|
+
: BTree.TNode<string>
|
|
69
|
+
= ['a']
|
|
63
70
|
_map = set(_map)('b')
|
|
64
71
|
_map = set(_map)('c')
|
|
65
72
|
_map = set(_map)('d')
|
|
@@ -67,8 +74,9 @@ const test = () => {
|
|
|
67
74
|
_map = set(_map)('f')
|
|
68
75
|
//
|
|
69
76
|
{
|
|
70
|
-
|
|
71
|
-
|
|
77
|
+
let _item
|
|
78
|
+
: list.Result<string>
|
|
79
|
+
= list.next(values(_map))
|
|
72
80
|
while (_item !== null) {
|
|
73
81
|
_item = list.next(_item.tail)
|
|
74
82
|
}
|
|
@@ -81,4 +89,4 @@ export default {
|
|
|
81
89
|
findTrue,
|
|
82
90
|
find,
|
|
83
91
|
test,
|
|
84
|
-
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type Array1<T> = readonly[T]
|
|
2
|
+
|
|
3
|
+
type Array2<T> = readonly[T,T]
|
|
4
|
+
|
|
5
|
+
type Array3<T> = readonly[T,T,T]
|
|
6
|
+
|
|
7
|
+
type Index2 = 0|1
|
|
8
|
+
|
|
9
|
+
type Index3 = 0|1|2
|
|
10
|
+
|
|
11
|
+
type Index5 = 0|1|2|3|4
|
|
12
|
+
|
|
13
|
+
export type Leaf1<T> = Array1<T>
|
|
14
|
+
|
|
15
|
+
export type Leaf2<T> = Array2<T>
|
|
16
|
+
|
|
17
|
+
export type Branch3<T> = readonly[TNode<T>, T, TNode<T>]
|
|
18
|
+
|
|
19
|
+
export type Branch5<T> = readonly[TNode<T>, T, TNode<T>, T, TNode<T>]
|
|
20
|
+
|
|
21
|
+
export type TNode<T> = Leaf1<T> | Leaf2<T> | Branch3<T> | Branch5<T>
|
|
22
|
+
|
|
23
|
+
export type Tree<T> = TNode<T> | null
|
|
24
|
+
|
|
25
|
+
export type Branch1<T> = readonly[TNode<T>]
|
|
26
|
+
|
|
27
|
+
export type Branch7<T> = readonly[...Branch5<T>, T, TNode<T>]
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as f from '../function/module.f.ts'
|
|
2
|
+
const { compose } = f
|
|
3
|
+
import * as RangeMap from '../range_map/module.f.ts'
|
|
4
|
+
import * as SortedSet from '../sorted_set/module.f.ts'
|
|
5
|
+
import * as list from '../list/module.f.ts'
|
|
6
|
+
const { reverse, countdown, flat, map } = list
|
|
7
|
+
|
|
8
|
+
export type ByteSet = bigint
|
|
9
|
+
type Byte = number
|
|
10
|
+
|
|
11
|
+
export const has
|
|
12
|
+
: (n: Byte) => (s: ByteSet) => boolean
|
|
13
|
+
= n => s => ((s >> BigInt(n)) & 1n) === 1n
|
|
14
|
+
|
|
15
|
+
// create a set
|
|
16
|
+
|
|
17
|
+
export const empty = 0n
|
|
18
|
+
|
|
19
|
+
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
|
20
|
+
export const universe = 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFFn
|
|
21
|
+
|
|
22
|
+
export const one
|
|
23
|
+
: (n: Byte) => ByteSet
|
|
24
|
+
= n => 1n << BigInt(n)
|
|
25
|
+
|
|
26
|
+
export const range
|
|
27
|
+
: (r: readonly[Byte, Byte]) => ByteSet
|
|
28
|
+
= ([b, e]) => one(e - b + 1) - 1n << BigInt(b)
|
|
29
|
+
|
|
30
|
+
// set operations
|
|
31
|
+
|
|
32
|
+
export const union
|
|
33
|
+
: (a: ByteSet) => (b: ByteSet) => ByteSet
|
|
34
|
+
= a => b => a | b
|
|
35
|
+
|
|
36
|
+
const intersect
|
|
37
|
+
: (a: ByteSet) => (b: ByteSet) => ByteSet
|
|
38
|
+
= a => b => a & b
|
|
39
|
+
|
|
40
|
+
export const complement
|
|
41
|
+
: (n: ByteSet) => ByteSet
|
|
42
|
+
= n => universe ^ n
|
|
43
|
+
|
|
44
|
+
const difference
|
|
45
|
+
: (a: ByteSet) => (b: ByteSet) => ByteSet
|
|
46
|
+
= compose(intersect)(compose(complement))
|
|
47
|
+
|
|
48
|
+
// additional operations
|
|
49
|
+
|
|
50
|
+
export const set = compose(one)(union)
|
|
51
|
+
|
|
52
|
+
export const setRange = compose(range)(union)
|
|
53
|
+
|
|
54
|
+
export const unset
|
|
55
|
+
: (n: Byte) => (s: ByteSet) => ByteSet
|
|
56
|
+
= n => s => difference(s)(one(n))
|
|
57
|
+
|
|
58
|
+
const counter = reverse(countdown(256))
|
|
59
|
+
|
|
60
|
+
const toRangeMapOp
|
|
61
|
+
: (n: ByteSet) => (s: string) => (i: number) => RangeMap.RangeMap<SortedSet.SortedSet<string>>
|
|
62
|
+
= n => s => i => {
|
|
63
|
+
const current = has(i + 1)(n)
|
|
64
|
+
const prev = has(i)(n)
|
|
65
|
+
return current === prev ? null : [[prev ? [s] : [], i]]
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const toRangeMap
|
|
69
|
+
: (n: ByteSet) => (s: string) => RangeMap.RangeMap<SortedSet.SortedSet<string>>
|
|
70
|
+
= n => s => flat(map(toRangeMapOp(n)(s))(counter))
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import * as _ from './module.f.
|
|
2
|
-
import * as list from '../list/module.f.
|
|
1
|
+
import * as _ from './module.f.ts'
|
|
2
|
+
import * as list from '../list/module.f.ts'
|
|
3
3
|
const { every, countdown, map, toArray } = list
|
|
4
|
-
import * as json from '../../json/module.f.
|
|
5
|
-
import * as o from '../object/module.f.
|
|
4
|
+
import * as json from '../../json/module.f.ts'
|
|
5
|
+
import * as o from '../object/module.f.ts'
|
|
6
6
|
const { sort } = o
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const stringify
|
|
9
|
+
: (a: readonly json.Unknown[]) => string
|
|
10
|
+
= json.stringify(sort)
|
|
10
11
|
|
|
11
12
|
export default {
|
|
12
13
|
has: [
|
|
@@ -47,7 +48,7 @@ export default {
|
|
|
47
48
|
}
|
|
48
49
|
],
|
|
49
50
|
universe: () => {
|
|
50
|
-
const x = every(map(v => _.has(v)(_.universe))(countdown(256)))
|
|
51
|
+
const x = every(map((v: any) => _.has(v)(_.universe))(countdown(256)))
|
|
51
52
|
if (!x) { throw x }
|
|
52
53
|
},
|
|
53
54
|
compliment: {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as Array from '../../array/module.f.ts'
|
|
2
|
+
|
|
3
|
+
export type Index3 = Array.Index3
|
|
4
|
+
|
|
5
|
+
export type Index5 = Array.Index5
|
|
6
|
+
|
|
7
|
+
type Array2<T> = Array.Array2<T>
|
|
8
|
+
|
|
9
|
+
export type Sign = -1|0|1
|
|
10
|
+
|
|
11
|
+
export type Compare<T> = (_: T) => Sign
|
|
12
|
+
|
|
13
|
+
export const index3
|
|
14
|
+
: <T>(cmp: Compare<T>) => (value: T) => Index3
|
|
15
|
+
= cmp => value => (cmp(value) + 1) as Index3
|
|
16
|
+
|
|
17
|
+
export const index5
|
|
18
|
+
: <T>(cmp: Compare<T>) => (v2: Array2<T>) => Index5
|
|
19
|
+
= cmp => ([v0, v1]) => {
|
|
20
|
+
const _0 = cmp(v0)
|
|
21
|
+
return (_0 <= 0 ? _0 + 1 : cmp(v1) + 3) as Index5
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const unsafeCmp
|
|
25
|
+
: <T>(a: T) => (b: T) => Sign
|
|
26
|
+
= a => b => a < b ? -1 : a > b ? 1 : 0
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A generic function type.
|
|
3
|
+
*/
|
|
4
|
+
type Func<I, O> = (_: I) => O
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A postfix compose function.
|
|
8
|
+
*/
|
|
9
|
+
export const compose
|
|
10
|
+
: <I, X>(g: Func<I, X>) => <O>(f: Func<X, O>) => Func<I, O>
|
|
11
|
+
= g => f => x => f(g(x))
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A generic identity function.
|
|
15
|
+
*/
|
|
16
|
+
export const identity
|
|
17
|
+
: <T>(value: T) => T
|
|
18
|
+
= value => value
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Flips the arguments of a curried function.
|
|
22
|
+
*/
|
|
23
|
+
export const flip
|
|
24
|
+
: <A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C
|
|
25
|
+
= f => b => a => f(a)(b)
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A functional utility type that enables seamless chaining of transformations.
|
|
29
|
+
*/
|
|
30
|
+
type Fn<I, O> = {
|
|
31
|
+
readonly result: Func<I, O>
|
|
32
|
+
readonly then: <T>(g: Func<O, T>) => Fn<I, T>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Creates an `Fn` instance from a function, enabling chaining of transformations.
|
|
37
|
+
*/
|
|
38
|
+
export const fn
|
|
39
|
+
: <I, O>(f: (i: I) => O) => Fn<I, O>
|
|
40
|
+
= result => ({
|
|
41
|
+
result,
|
|
42
|
+
then: g => fn(compose(result)(g))
|
|
43
|
+
})
|