functionalscript 0.2.6 → 0.3.1
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 +20 -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} +66 -61
- 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,21 +0,0 @@
|
|
|
1
|
-
/** @type {(name: string) => <T>(map: Map<T>) => T|null} */
|
|
2
|
-
export const at: (name: string) => <T>(map: Map<T>) => T | null;
|
|
3
|
-
/** @type {<T>(reduce: Operator.Reduce<T>) => (name: string) => (value: T) => (map: Map<T>) => Map<T>} */
|
|
4
|
-
export const setReduce: <T>(reduce: Operator.Reduce<T>) => (name: string) => (value: T) => (map: Map<T>) => Map<T>;
|
|
5
|
-
/** @type {(name: string) => <T>(value: T) => (map: Map<T>) => Map<T>} */
|
|
6
|
-
export const setReplace: (name: string) => <T>(value: T) => (map: Map<T>) => Map<T>;
|
|
7
|
-
/** @type {<T>(map: Map<T>) => list.List<Entry<T>>} */
|
|
8
|
-
export const entries: <T>(map: Map<T>) => list.List<Entry<T>>;
|
|
9
|
-
/** @type {<T>(entries: list.List<Entry<T>>) => Map<T>} */
|
|
10
|
-
export const fromEntries: <T>(entries: list.List<Entry<T>>) => Map<T>;
|
|
11
|
-
/** @type {(name: string) => <T>(map: Map<T>) => Map<T>} */
|
|
12
|
-
export const remove: (name: string) => <T>(map: Map<T>) => Map<T>;
|
|
13
|
-
export const empty: null;
|
|
14
|
-
export type Sign = Compare.Sign;
|
|
15
|
-
export type Cmp<T> = Compare.Compare<T>;
|
|
16
|
-
export type Entry<T> = readonly [string, T];
|
|
17
|
-
export type Map<T> = BtreeTypes.Tree<Entry<T>>;
|
|
18
|
-
import * as Operator from '../function/operator/module.f.mjs';
|
|
19
|
-
import * as list from '../list/module.f.mjs';
|
|
20
|
-
import * as Compare from '../function/compare/module.f.mjs';
|
|
21
|
-
import * as BtreeTypes from '../btree/types/module.f.mjs';
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// @ts-self-types="./module.f.d.mts"
|
|
2
|
-
import * as BtreeTypes from '../btree/types/module.f.mjs';
|
|
3
|
-
import * as btf from '../btree/find/module.f.mjs';
|
|
4
|
-
const { value, find } = btf;
|
|
5
|
-
import * as bts from '../btree/set/module.f.mjs';
|
|
6
|
-
const { set } = bts;
|
|
7
|
-
import * as btr from '../btree/remove/module.f.mjs';
|
|
8
|
-
const { remove: btreeRemove } = btr;
|
|
9
|
-
import * as bt from '../btree/module.f.mjs';
|
|
10
|
-
const { values } = bt;
|
|
11
|
-
import * as Compare from '../function/compare/module.f.mjs';
|
|
12
|
-
import * as s from '../string/module.f.mjs';
|
|
13
|
-
const { cmp } = s;
|
|
14
|
-
import * as list from '../list/module.f.mjs';
|
|
15
|
-
const { fold } = list;
|
|
16
|
-
import * as Operator from '../function/operator/module.f.mjs';
|
|
17
|
-
/** @typedef {Compare.Sign} Sign */
|
|
18
|
-
/**
|
|
19
|
-
* @template T
|
|
20
|
-
* @typedef {Compare.Compare<T>} Cmp
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* @template T
|
|
24
|
-
* @typedef {readonly[string, T]} Entry
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* @template T
|
|
28
|
-
* @typedef {BtreeTypes.Tree<Entry<T>>} Map
|
|
29
|
-
*/
|
|
30
|
-
/** @type {(a: string) => <T>(b: Entry<T>) => Sign} */
|
|
31
|
-
const keyCmp = a => ([b]) => cmp(a)(b);
|
|
32
|
-
/** @type {(name: string) => <T>(map: Map<T>) => T|null} */
|
|
33
|
-
export const at = name => map => {
|
|
34
|
-
if (map === null) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
const result = value(find(keyCmp(name))(map).first);
|
|
38
|
-
return result === null ? null : result[1];
|
|
39
|
-
};
|
|
40
|
-
/** @type {<T>(reduce: Operator.Reduce<T>) => (entry: Entry<T>) => (map: Map<T>) => Map<T>} */
|
|
41
|
-
const setReduceEntry = reduce => entry => set(keyCmp(entry[0]))(old => old === null ? entry : [old[0], reduce(old[1])(entry[1])]);
|
|
42
|
-
/** @type {<T>(reduce: Operator.Reduce<T>) => (name: string) => (value: T) => (map: Map<T>) => Map<T>} */
|
|
43
|
-
export const setReduce = reduce => name => value => setReduceEntry(reduce)([name, value]);
|
|
44
|
-
/** @type {<T>(a: T) => (b: T) => T} */
|
|
45
|
-
const replace = () => b => b;
|
|
46
|
-
/** @type {(name: string) => <T>(value: T) => (map: Map<T>) => Map<T>} */
|
|
47
|
-
export const setReplace = name => value => setReduceEntry(replace)([name, value]);
|
|
48
|
-
/** @type {<T>(map: Map<T>) => list.List<Entry<T>>} */
|
|
49
|
-
export const entries = values;
|
|
50
|
-
/** @type {<T>(entries: list.List<Entry<T>>) => Map<T>} */
|
|
51
|
-
export const fromEntries = fold(setReduceEntry(replace))(null);
|
|
52
|
-
/** @type {(name: string) => <T>(map: Map<T>) => Map<T>} */
|
|
53
|
-
export const remove = name => btreeRemove(keyCmp(name));
|
|
54
|
-
export const empty = null;
|
package/out/types/map/test.f.mjs
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import * as _ from './module.f.mjs';
|
|
2
|
-
const { at, setReplace, setReduce, empty, entries, remove } = _;
|
|
3
|
-
import * as seq from '../list/module.f.mjs';
|
|
4
|
-
export default {
|
|
5
|
-
main: [
|
|
6
|
-
() => {
|
|
7
|
-
let m = setReplace('a')(1)(null);
|
|
8
|
-
if (at('a')(m) !== 1) {
|
|
9
|
-
throw 'error';
|
|
10
|
-
}
|
|
11
|
-
if (at('b')(m) !== null) {
|
|
12
|
-
throw 'error';
|
|
13
|
-
}
|
|
14
|
-
m = setReplace('b')(2)(m);
|
|
15
|
-
if (at('a')(m) !== 1) {
|
|
16
|
-
throw 'error';
|
|
17
|
-
}
|
|
18
|
-
if (at('b')(m) !== 2) {
|
|
19
|
-
throw 'error';
|
|
20
|
-
}
|
|
21
|
-
if (at('c')(m) !== null) {
|
|
22
|
-
throw 'error';
|
|
23
|
-
}
|
|
24
|
-
m = setReplace('z')(3)(m);
|
|
25
|
-
if (at('a')(m) !== 1) {
|
|
26
|
-
throw 'error';
|
|
27
|
-
}
|
|
28
|
-
if (at('b')(m) !== 2) {
|
|
29
|
-
throw 'error';
|
|
30
|
-
}
|
|
31
|
-
if (at('z')(m) !== 3) {
|
|
32
|
-
throw 'error';
|
|
33
|
-
}
|
|
34
|
-
if (at('')(m) !== null) {
|
|
35
|
-
throw 'error';
|
|
36
|
-
}
|
|
37
|
-
m = setReplace('')(4)(m);
|
|
38
|
-
if (at('a')(m) !== 1) {
|
|
39
|
-
throw 'error';
|
|
40
|
-
}
|
|
41
|
-
if (at('b')(m) !== 2) {
|
|
42
|
-
throw 'error';
|
|
43
|
-
}
|
|
44
|
-
if (at('z')(m) !== 3) {
|
|
45
|
-
throw 'error';
|
|
46
|
-
}
|
|
47
|
-
if (at('')(m) !== 4) {
|
|
48
|
-
throw 'error';
|
|
49
|
-
}
|
|
50
|
-
if (at('Hello world!')(m) !== null) {
|
|
51
|
-
throw 'error';
|
|
52
|
-
}
|
|
53
|
-
m = setReplace('Hello world!')(42)(m);
|
|
54
|
-
if (at('a')(m) !== 1) {
|
|
55
|
-
throw 'error';
|
|
56
|
-
}
|
|
57
|
-
if (at('b')(m) !== 2) {
|
|
58
|
-
throw 'error';
|
|
59
|
-
}
|
|
60
|
-
if (at('z')(m) !== 3) {
|
|
61
|
-
throw 'error';
|
|
62
|
-
}
|
|
63
|
-
if (at('')(m) !== 4) {
|
|
64
|
-
throw 'error';
|
|
65
|
-
}
|
|
66
|
-
if (at('Hello world!')(m) !== 42) {
|
|
67
|
-
throw 'error';
|
|
68
|
-
}
|
|
69
|
-
if (at('x')(m) !== null) {
|
|
70
|
-
throw 'error';
|
|
71
|
-
}
|
|
72
|
-
// console.log(Array.from(m.entries()))
|
|
73
|
-
m = remove('Hello world!')(m);
|
|
74
|
-
if (at('Hello world!')(m) !== null) {
|
|
75
|
-
throw m;
|
|
76
|
-
}
|
|
77
|
-
m = setReduce(a => b => a + b)('a')(43)(m);
|
|
78
|
-
if (at('a')(m) !== 44) {
|
|
79
|
-
throw 'error';
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
() => {
|
|
83
|
-
let m = setReplace('x')(12)(null);
|
|
84
|
-
m = setReplace('y')(44)(m);
|
|
85
|
-
if (at('x')(m) !== 12) {
|
|
86
|
-
throw 'error';
|
|
87
|
-
}
|
|
88
|
-
if (at('y')(m) !== 44) {
|
|
89
|
-
throw 'error';
|
|
90
|
-
}
|
|
91
|
-
if (at('a')(m) !== null) {
|
|
92
|
-
throw 'error';
|
|
93
|
-
}
|
|
94
|
-
const e = seq.toArray(entries(m));
|
|
95
|
-
if (e.length !== 2) {
|
|
96
|
-
throw 'error';
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
stress: () => {
|
|
101
|
-
/** @type {import('./module.f.mjs').Map<number>} */
|
|
102
|
-
let m = empty;
|
|
103
|
-
for (let i = 0; i < 100_000; ++i) {
|
|
104
|
-
m = setReplace((i * i).toString())(i)(m);
|
|
105
|
-
/*
|
|
106
|
-
console.log()
|
|
107
|
-
console.log(`# ${i}`)
|
|
108
|
-
console.log()
|
|
109
|
-
for (const e of m.struct()) {
|
|
110
|
-
console.log(e)
|
|
111
|
-
}
|
|
112
|
-
*/
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/** @typedef {number} NibbleSet */
|
|
2
|
-
/** @typedef {number} Nibble */
|
|
3
|
-
export const empty: 0;
|
|
4
|
-
export const universe: 65535;
|
|
5
|
-
/** @type {(n: Nibble) => (s: NibbleSet) => boolean} */
|
|
6
|
-
export const has: (n: Nibble) => (s: NibbleSet) => boolean;
|
|
7
|
-
/** @type {(n: Nibble) => (s: NibbleSet) => NibbleSet} */
|
|
8
|
-
export const set: (n: Nibble) => (s: NibbleSet) => NibbleSet;
|
|
9
|
-
/** @type {(n: NibbleSet) => NibbleSet} */
|
|
10
|
-
export const complement: (n: NibbleSet) => NibbleSet;
|
|
11
|
-
/** @type {(n: Nibble) => (s: NibbleSet) => NibbleSet} */
|
|
12
|
-
export const unset: (n: Nibble) => (s: NibbleSet) => NibbleSet;
|
|
13
|
-
/** @type {(r: readonly[number, number]) => (s: NibbleSet) => NibbleSet} */
|
|
14
|
-
export const setRange: (r: readonly [number, number]) => (s: NibbleSet) => NibbleSet;
|
|
15
|
-
export type NibbleSet = number;
|
|
16
|
-
export type Nibble = number;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// @ts-self-types="./module.f.d.mts"
|
|
2
|
-
/** @typedef {number} NibbleSet */
|
|
3
|
-
/** @typedef {number} Nibble */
|
|
4
|
-
export const empty = 0;
|
|
5
|
-
export const universe = 0xFFFF;
|
|
6
|
-
/** @type {(n: Nibble) => NibbleSet} */
|
|
7
|
-
const one = n => 1 << n;
|
|
8
|
-
/** @type {(n: Nibble) => (s: NibbleSet) => boolean} */
|
|
9
|
-
export const has = n => s => ((s >> n) & 1) === 1;
|
|
10
|
-
/** @type {(n: Nibble) => (s: NibbleSet) => NibbleSet} */
|
|
11
|
-
export const set = n => s => s | one(n);
|
|
12
|
-
/** @type {(n: NibbleSet) => NibbleSet} */
|
|
13
|
-
export const complement = s => universe ^ s;
|
|
14
|
-
/** @type {(n: Nibble) => (s: NibbleSet) => NibbleSet} */
|
|
15
|
-
export const unset = n => s => s & complement(one(n));
|
|
16
|
-
/** @type {(r: readonly[number, number]) => NibbleSet} */
|
|
17
|
-
const range = ([a, b]) => one(b - a + 1) - 1 << a;
|
|
18
|
-
/** @type {(r: readonly[number, number]) => (s: NibbleSet) => NibbleSet} */
|
|
19
|
-
export const setRange = r => s => s | range(r);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
function has(): void;
|
|
3
|
-
let set: (() => void)[];
|
|
4
|
-
function unset(): (() => void)[];
|
|
5
|
-
function setRange(): void;
|
|
6
|
-
function universe(): void;
|
|
7
|
-
namespace compliment {
|
|
8
|
-
export function empty(): void;
|
|
9
|
-
export function universe_1(): void;
|
|
10
|
-
export { universe_1 as universe };
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export default _default;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import * as list from '../list/module.f.mjs';
|
|
2
|
-
const { every, map, countdown } = list;
|
|
3
|
-
import * as _ from './module.f.mjs';
|
|
4
|
-
export default {
|
|
5
|
-
has: () => {
|
|
6
|
-
if (_.has(0)(_.empty)) {
|
|
7
|
-
throw _.empty;
|
|
8
|
-
}
|
|
9
|
-
if (_.has(1)(_.empty)) {
|
|
10
|
-
throw _.empty;
|
|
11
|
-
}
|
|
12
|
-
if (_.has(15)(_.empty)) {
|
|
13
|
-
throw _.empty;
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
set: [
|
|
17
|
-
() => {
|
|
18
|
-
const s = _.set(0)(_.empty);
|
|
19
|
-
if (s !== 1) {
|
|
20
|
-
throw s;
|
|
21
|
-
}
|
|
22
|
-
if (!_.has(0)(s)) {
|
|
23
|
-
throw s;
|
|
24
|
-
}
|
|
25
|
-
if (_.has(1)(s)) {
|
|
26
|
-
throw s;
|
|
27
|
-
}
|
|
28
|
-
if (_.has(15)(s)) {
|
|
29
|
-
throw s;
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
() => {
|
|
33
|
-
const s = _.set(15)(_.empty);
|
|
34
|
-
if (s !== 0x8000) {
|
|
35
|
-
throw s;
|
|
36
|
-
}
|
|
37
|
-
if (_.has(0)(s)) {
|
|
38
|
-
throw s;
|
|
39
|
-
}
|
|
40
|
-
if (_.has(1)(s)) {
|
|
41
|
-
throw s;
|
|
42
|
-
}
|
|
43
|
-
if (!_.has(15)(s)) {
|
|
44
|
-
throw s;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
unset: () => [
|
|
49
|
-
() => {
|
|
50
|
-
const a = _.set(0)(_.empty);
|
|
51
|
-
const result = _.unset(0)(a);
|
|
52
|
-
if (result !== 0) {
|
|
53
|
-
throw result;
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
() => {
|
|
57
|
-
const a = _.set(15)(_.empty);
|
|
58
|
-
const result = _.unset(15)(a);
|
|
59
|
-
if (result !== 0) {
|
|
60
|
-
throw result;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
],
|
|
64
|
-
setRange: () => {
|
|
65
|
-
const result = _.setRange([2, 5])(_.empty);
|
|
66
|
-
if (result !== 60) {
|
|
67
|
-
throw result;
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
universe: () => {
|
|
71
|
-
const x = every(map(v => _.has(v)(_.universe))(countdown(16)));
|
|
72
|
-
if (!x) {
|
|
73
|
-
throw x;
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
compliment: {
|
|
77
|
-
empty: () => {
|
|
78
|
-
const r = _.complement(_.empty);
|
|
79
|
-
if (r !== _.universe) {
|
|
80
|
-
throw r;
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
universe: () => {
|
|
84
|
-
const r = _.complement(_.universe);
|
|
85
|
-
if (r !== _.empty) {
|
|
86
|
-
throw r;
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
}
|
|
90
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @template T
|
|
3
|
-
* @typedef {T|null} Nullable
|
|
4
|
-
*/
|
|
5
|
-
/** @type {<T, R>(f: (value: T) => R) => (value: Nullable<T>) => Nullable<R>} */
|
|
6
|
-
export const map: <T, R>(f: (value: T) => R) => (value: Nullable<T>) => Nullable<R>;
|
|
7
|
-
/** @type {<T, R>(f: (_: T) => R) => (none: () => R) => (_: Nullable<T>) => Nullable<R>} */
|
|
8
|
-
export const match: <T, R>(f: (_: T) => R) => (none: () => R) => (_: Nullable<T>) => Nullable<R>;
|
|
9
|
-
export type Nullable<T> = T | null;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// @ts-self-types="./module.f.d.mts"
|
|
2
|
-
/**
|
|
3
|
-
* @template T
|
|
4
|
-
* @typedef {T|null} Nullable
|
|
5
|
-
*/
|
|
6
|
-
/** @type {<T, R>(f: (value: T) => R) => (value: Nullable<T>) => Nullable<R>} */
|
|
7
|
-
export const map = f => value => value === null ? null : f(value);
|
|
8
|
-
/** @type {<T, R>(f: (_: T) => R) => (none: () => R) => (_: Nullable<T>) => Nullable<R>} */
|
|
9
|
-
export const match = f => none => value => value === null ? none() : f(value);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export const sum: (input: list.List<number>) => number;
|
|
2
|
-
export const min: (input: list.List<number>) => number | null;
|
|
3
|
-
export const max: (input: list.List<number>) => number | null;
|
|
4
|
-
/** @type {(a: number) => (b: number) => compare.Sign} */
|
|
5
|
-
export const cmp: (a: number) => (b: number) => compare.Sign;
|
|
6
|
-
import * as list from '../list/module.f.mjs';
|
|
7
|
-
import * as compare from '../function/compare/module.f.mjs';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// @ts-self-types="./module.f.d.mts"
|
|
2
|
-
import * as list from '../list/module.f.mjs';
|
|
3
|
-
const { reduce } = list;
|
|
4
|
-
import * as operator from '../function/operator/module.f.mjs';
|
|
5
|
-
const { addition, min: minOp, max: maxOp } = operator;
|
|
6
|
-
import * as compare from '../function/compare/module.f.mjs';
|
|
7
|
-
const { unsafeCmp } = compare;
|
|
8
|
-
export const sum = reduce(addition)(0);
|
|
9
|
-
export const min = reduce(minOp)(null);
|
|
10
|
-
export const max = reduce(maxOp)(null);
|
|
11
|
-
/** @type {(a: number) => (b: number) => compare.Sign} */
|
|
12
|
-
export const cmp = unsafeCmp;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import * as _ from './module.f.mjs';
|
|
2
|
-
const { sum, min, max, cmp } = _;
|
|
3
|
-
export default {
|
|
4
|
-
sum: () => {
|
|
5
|
-
const result = sum([2, 3, 4, 5]);
|
|
6
|
-
if (result !== 14) {
|
|
7
|
-
throw result;
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
min: {
|
|
11
|
-
empty: () => {
|
|
12
|
-
const result = min([]);
|
|
13
|
-
if (result !== null) {
|
|
14
|
-
throw result;
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
multi: () => {
|
|
18
|
-
const result = min([1, 2, 12, -4, 8]);
|
|
19
|
-
if (result !== -4) {
|
|
20
|
-
throw result;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
max: () => {
|
|
25
|
-
const result = max([1, 2, 12, -4, 8]);
|
|
26
|
-
if (result !== 12) {
|
|
27
|
-
throw result;
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
cmp: () => {
|
|
31
|
-
const result = cmp(4)(5);
|
|
32
|
-
if (result !== -1) {
|
|
33
|
-
throw result;
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
standard: () => {
|
|
37
|
-
/** @type {(a: bigint) => (a: bigint) => void} */
|
|
38
|
-
const check = a => b => {
|
|
39
|
-
if (BigInt(Number(a)) != b) {
|
|
40
|
-
throw [a, b];
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
/** @type {(v: bigint) => void} */
|
|
44
|
-
const eq = v => check(v)(v);
|
|
45
|
-
// 53, 0x35 bits.
|
|
46
|
-
// 3 2 1 0
|
|
47
|
-
// 4_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210
|
|
48
|
-
eq(4503599627370496n);
|
|
49
|
-
eq(4503599627370497n);
|
|
50
|
-
eq(4503599627370498n);
|
|
51
|
-
eq(4503599627370499n);
|
|
52
|
-
eq(4503599627370500n);
|
|
53
|
-
//
|
|
54
|
-
eq(8205552883602248n);
|
|
55
|
-
eq(6023495077481713n);
|
|
56
|
-
eq(7655550916643882n);
|
|
57
|
-
eq(7408615831253283n);
|
|
58
|
-
eq(5372046171422892n);
|
|
59
|
-
//
|
|
60
|
-
eq(9007199254740991n);
|
|
61
|
-
eq(9007199254740990n);
|
|
62
|
-
eq(9007199254740989n);
|
|
63
|
-
eq(9007199254740988n);
|
|
64
|
-
eq(9007199254740987n);
|
|
65
|
-
eq(9007199254740986n);
|
|
66
|
-
eq(9007199254740985n);
|
|
67
|
-
eq(9007199254740984n);
|
|
68
|
-
// 54, 0x35+1 bits.
|
|
69
|
-
// 3 2 1 0
|
|
70
|
-
// 4_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210_1
|
|
71
|
-
check(9007199254740992n)(9007199254740992n);
|
|
72
|
-
check(16585805050637558n)(16585805050637558n);
|
|
73
|
-
check(18014398509481982n)(18014398509481982n);
|
|
74
|
-
// round down
|
|
75
|
-
check(9007199254740993n)(9007199254740992n);
|
|
76
|
-
check(9007199254740997n)(9007199254740996n);
|
|
77
|
-
check(11727370849309157n)(11727370849309156n);
|
|
78
|
-
check(18014398509481981n)(18014398509481980n);
|
|
79
|
-
// round up
|
|
80
|
-
check(9007199254740995n)(9007199254740996n);
|
|
81
|
-
check(15679542343753527n)(15679542343753528n);
|
|
82
|
-
check(18014398509481983n)(18014398509481984n);
|
|
83
|
-
// 55, 0x35+2 bits.
|
|
84
|
-
// 3 2 1 0
|
|
85
|
-
// 4_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210_12
|
|
86
|
-
// 0_xx: down, down, up
|
|
87
|
-
// 0_00
|
|
88
|
-
check(18014398509481984n)(18014398509481984n);
|
|
89
|
-
check(31009640954244032n)(31009640954244032n);
|
|
90
|
-
check(36028797018963960n)(36028797018963960n);
|
|
91
|
-
// 0_01 round down
|
|
92
|
-
check(18014398509481985n)(18014398509481984n);
|
|
93
|
-
check(35865859090492321n)(35865859090492320n);
|
|
94
|
-
check(36028797018963961n)(36028797018963960n);
|
|
95
|
-
// 0_10 round down
|
|
96
|
-
check(18014398509481986n)(18014398509481984n);
|
|
97
|
-
check(20537830900813786n)(20537830900813784n);
|
|
98
|
-
check(36028797018963962n)(36028797018963960n);
|
|
99
|
-
// 0_11 round up
|
|
100
|
-
check(18014398509481987n)(18014398509481988n);
|
|
101
|
-
check(20762549594556867n)(20762549594556868n);
|
|
102
|
-
check(36028797018963963n)(36028797018963964n);
|
|
103
|
-
// 1_xx: down, up, up
|
|
104
|
-
// 1_00
|
|
105
|
-
check(18014398509481988n)(18014398509481988n);
|
|
106
|
-
check(27158415062912468n)(27158415062912468n);
|
|
107
|
-
check(36028797018963963n)(36028797018963964n);
|
|
108
|
-
// 1_01 round down
|
|
109
|
-
check(18014398509481989n)(18014398509481988n);
|
|
110
|
-
check(23136524663958789n)(23136524663958788n);
|
|
111
|
-
check(36028797018963965n)(36028797018963964n);
|
|
112
|
-
// 1_10 round up
|
|
113
|
-
check(18014398509481990n)(18014398509481992n);
|
|
114
|
-
check(35732739218314830n)(35732739218314832n);
|
|
115
|
-
check(36028797018963966n)(36028797018963968n);
|
|
116
|
-
// 1_11 round up
|
|
117
|
-
check(18014398509481991n)(18014398509481992n);
|
|
118
|
-
check(35015291789494295n)(35015291789494296n);
|
|
119
|
-
check(36028797018963967n)(36028797018963968n);
|
|
120
|
-
// 57, 0x35+4 bits.
|
|
121
|
-
// 3 2 1 0
|
|
122
|
-
// 4_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210_1234
|
|
123
|
-
check(104002482718319358n)(104002482718319360n);
|
|
124
|
-
check(142693895881191444n)(142693895881191440n);
|
|
125
|
-
}
|
|
126
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @template T
|
|
3
|
-
* @typedef {{
|
|
4
|
-
* readonly [k in string]: T
|
|
5
|
-
* }} Map
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* @template T
|
|
9
|
-
* @typedef {readonly[string, T]} Entry
|
|
10
|
-
*/
|
|
11
|
-
/** @type {(name: string) => <T>(object: Map<T>) => T|null} */
|
|
12
|
-
export const at: (name: string) => <T>(object: Map<T>) => T | null;
|
|
13
|
-
/** @type {<T>(e: list.List<Entry<T>>) => list.List<Entry<T>>} */
|
|
14
|
-
export const sort: <T>(e: list.List<Entry<T>>) => list.List<Entry<T>>;
|
|
15
|
-
/** @type {<T>(e: list.List<Entry<T>>) => Map<T>} */
|
|
16
|
-
export const fromEntries: <T>(e: list.List<Entry<T>>) => Map<T>;
|
|
17
|
-
/** @type {<T>(m: btMap.Map<T>) => Map<T>} */
|
|
18
|
-
export const fromMap: <T>(m: btMap.Map<T>) => Map<T>;
|
|
19
|
-
export type Map<T> = { readonly [k in string]: T; };
|
|
20
|
-
export type Entry<T> = readonly [string, T];
|
|
21
|
-
import * as list from '../list/module.f.mjs';
|
|
22
|
-
import * as btMap from '../map/module.f.mjs';
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// @ts-self-types="./module.f.d.mts"
|
|
2
|
-
import * as list from '../list/module.f.mjs';
|
|
3
|
-
const { iterable } = list;
|
|
4
|
-
import * as btMap from '../map/module.f.mjs';
|
|
5
|
-
const { entries: mapEntries, fromEntries: mapFromEntries } = btMap;
|
|
6
|
-
const { getOwnPropertyDescriptor, fromEntries: objectFromEntries } = Object;
|
|
7
|
-
/**
|
|
8
|
-
* @template T
|
|
9
|
-
* @typedef {{
|
|
10
|
-
* readonly [k in string]: T
|
|
11
|
-
* }} Map
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* @template T
|
|
15
|
-
* @typedef {readonly[string, T]} Entry
|
|
16
|
-
*/
|
|
17
|
-
/** @type {(name: string) => <T>(object: Map<T>) => T|null} */
|
|
18
|
-
export const at = name => object => {
|
|
19
|
-
const r = getOwnPropertyDescriptor(object, name);
|
|
20
|
-
return r === void 0 ? null : r.value;
|
|
21
|
-
};
|
|
22
|
-
/** @type {<T>(e: list.List<Entry<T>>) => list.List<Entry<T>>} */
|
|
23
|
-
export const sort = e => mapEntries(mapFromEntries(e));
|
|
24
|
-
/** @type {<T>(e: list.List<Entry<T>>) => Map<T>} */
|
|
25
|
-
export const fromEntries = e => objectFromEntries(iterable(e));
|
|
26
|
-
/** @type {<T>(m: btMap.Map<T>) => Map<T>} */
|
|
27
|
-
export const fromMap = m => fromEntries(mapEntries(m));
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as _ from './module.f.mjs';
|
|
2
|
-
export default {
|
|
3
|
-
ctor: () => {
|
|
4
|
-
const a = {};
|
|
5
|
-
const value = _.at('constructor')(a);
|
|
6
|
-
if (value !== null) {
|
|
7
|
-
throw value;
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
property: () => {
|
|
11
|
-
const a = { constructor: 42 };
|
|
12
|
-
const value = _.at('constructor')(a);
|
|
13
|
-
if (value !== 42) {
|
|
14
|
-
throw value;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/** @typedef {readonly[number,number]} Range */
|
|
2
|
-
/** @type {(range: Range) => (i: number) => boolean} */
|
|
3
|
-
export const contains: (range: Range) => (i: number) => boolean;
|
|
4
|
-
/** @type {(i: number) => Range} */
|
|
5
|
-
export const one: (i: number) => Range;
|
|
6
|
-
export type Range = readonly [number, number];
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// @ts-self-types="./module.f.d.mts"
|
|
2
|
-
/** @typedef {readonly[number,number]} Range */
|
|
3
|
-
/** @type {(range: Range) => (i: number) => boolean} */
|
|
4
|
-
export const contains = ([b, e]) => i => b <= i && i <= e;
|
|
5
|
-
/** @type {(i: number) => Range} */
|
|
6
|
-
export const one = a => [a, a];
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as _ from './module.f.mjs';
|
|
2
|
-
export default () => {
|
|
3
|
-
if (!_.contains([0, 5])(1)) {
|
|
4
|
-
throw 1;
|
|
5
|
-
}
|
|
6
|
-
if (!_.contains([0, 5])(0)) {
|
|
7
|
-
throw 0;
|
|
8
|
-
}
|
|
9
|
-
if (!_.contains([0, 5])(5)) {
|
|
10
|
-
throw 5;
|
|
11
|
-
}
|
|
12
|
-
if (_.contains([0, 5])(-1)) {
|
|
13
|
-
throw -1;
|
|
14
|
-
}
|
|
15
|
-
if (_.contains([0, 5])(6)) {
|
|
16
|
-
throw 6;
|
|
17
|
-
}
|
|
18
|
-
};
|