functionalscript 0.1.609 → 0.2.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/com/cpp/module.f.mjs +20 -25
- package/com/cpp/testlib.f.mjs +3 -4
- package/com/cs/module.f.mjs +18 -23
- package/com/cs/testlib.f.mjs +3 -5
- package/com/rust/module.f.mjs +25 -30
- package/com/rust/testlib.f.mjs +3 -5
- package/com/test/build.f.mjs +2 -2
- package/com/test/build.mjs +4 -4
- package/com/types/module.f.mjs +5 -12
- package/commonjs/build/module.f.mjs +23 -28
- package/commonjs/build/test.f.mjs +4 -4
- package/commonjs/module/function/module.f.mjs +0 -2
- package/commonjs/module/module.f.mjs +2 -9
- package/commonjs/module.f.mjs +0 -2
- package/commonjs/module.mjs +2 -7
- package/commonjs/package/dependencies/module.f.mjs +5 -10
- package/commonjs/package/dependencies/test.f.mjs +1 -1
- package/commonjs/package/module.f.mjs +6 -13
- package/commonjs/package/test.f.mjs +1 -1
- package/commonjs/path/module.f.mjs +12 -23
- package/commonjs/path/test.f.mjs +11 -11
- package/commonjs/test.mjs +1 -1
- package/dev/module.f.mjs +1 -4
- package/dev/module.mjs +1 -1
- package/dev/test/module.f.mjs +4 -6
- package/djs/module.f.mjs +12 -19
- package/djs/parser/module.f.mjs +18 -24
- package/djs/parser/test.f.mjs +9 -9
- package/djs/test.f.mjs +4 -4
- package/djs/tokenizer/module.f.mjs +18 -23
- package/djs/tokenizer/test.f.mjs +6 -6
- package/fsc/module.f.mjs +17 -24
- package/fsc/test.f.mjs +3 -3
- package/fsm/module.f.mjs +27 -38
- package/fsm/test.f.mjs +8 -8
- package/html/module.f.mjs +14 -23
- package/html/test.f.mjs +4 -4
- package/js/tokenizer/module.f.mjs +55 -62
- package/js/tokenizer/test.f.mjs +6 -6
- package/json/module.f.mjs +18 -31
- package/json/parser/module.f.mjs +9 -14
- package/json/parser/test.f.mjs +7 -7
- package/json/serializer/module.f.mjs +14 -29
- package/json/serializer/test.f.mjs +2 -2
- package/json/test.f.mjs +3 -3
- package/json/tokenizer/module.f.mjs +14 -19
- package/json/tokenizer/test.f.mjs +6 -6
- package/jsr.json +59 -59
- package/nodejs/version/main.mjs +1 -1
- package/nodejs/version/module.f.mjs +2 -7
- package/nodejs/version/test.f.mjs +3 -3
- package/out/com/cpp/module.f.d.mts +4 -0
- package/out/com/cpp/module.f.mjs +123 -0
- package/out/com/cpp/test.f.mjs +40 -0
- package/out/com/cpp/testlib.f.mjs +7 -0
- package/out/com/cs/module.f.d.mts +4 -0
- package/out/com/cs/module.f.mjs +95 -0
- package/out/com/cs/test.f.mjs +43 -0
- package/out/com/cs/testlib.f.mjs +7 -0
- package/{com → out/com}/rust/module.f.d.mts +3 -7
- package/out/com/rust/module.f.mjs +213 -0
- package/out/com/rust/test.f.mjs +123 -0
- package/out/com/rust/testlib.f.mjs +7 -0
- package/{com → out/com}/test/build.f.d.mts +2 -2
- package/out/com/test/build.f.mjs +98 -0
- package/out/com/test/build.mjs +40 -0
- package/{com → out/com}/types/module.f.d.mts +5 -10
- package/out/com/types/module.f.mjs +51 -0
- package/out/com/types/testlib.f.mjs +30 -0
- package/out/commonjs/build/module.f.d.mts +20 -0
- package/out/commonjs/build/module.f.mjs +107 -0
- package/out/commonjs/build/test.f.mjs +102 -0
- package/{commonjs → out/commonjs}/module/function/module.f.d.mts +0 -2
- package/out/commonjs/module/function/module.f.mjs +15 -0
- package/{commonjs → out/commonjs}/module/module.f.d.mts +16 -21
- package/out/commonjs/module/module.f.mjs +48 -0
- package/out/commonjs/module.d.mts +3 -0
- package/{commonjs → out/commonjs}/module.f.d.mts +0 -2
- package/out/commonjs/module.f.mjs +10 -0
- package/out/commonjs/module.mjs +26 -0
- package/out/commonjs/package/dependencies/module.f.d.mts +6 -0
- package/out/commonjs/package/dependencies/module.f.mjs +21 -0
- package/out/commonjs/package/dependencies/test.f.mjs +15 -0
- package/out/commonjs/package/module.f.d.mts +21 -0
- package/out/commonjs/package/module.f.mjs +40 -0
- package/out/commonjs/package/test.f.mjs +27 -0
- package/{commonjs → out/commonjs}/path/module.f.d.mts +25 -32
- package/out/commonjs/path/module.f.mjs +171 -0
- package/out/commonjs/path/test.f.mjs +231 -0
- package/out/commonjs/test.mjs +87 -0
- package/out/dev/index.mjs +2 -0
- package/out/dev/module.f.d.mts +1 -0
- package/out/dev/module.f.mjs +2 -0
- package/out/dev/module.mjs +167 -0
- package/{dev → out/dev}/test/module.f.d.mts +2 -3
- package/out/dev/test/module.f.mjs +134 -0
- package/out/dev/test.f.mjs +58 -0
- package/out/dev/test.mjs +52 -0
- package/{djs → out/djs}/module.f.d.mts +13 -18
- package/out/djs/module.f.mjs +75 -0
- package/{djs → out/djs}/parser/module.f.d.mts +11 -15
- package/out/djs/parser/module.f.mjs +432 -0
- package/out/djs/parser/test.f.mjs +535 -0
- package/out/djs/test.f.mjs +84 -0
- package/out/djs/tokenizer/module.f.d.mts +13 -0
- package/out/djs/tokenizer/module.f.mjs +87 -0
- package/out/djs/tokenizer/test.f.mjs +480 -0
- package/out/fsc/module.f.d.mts +7 -0
- package/out/fsc/module.f.mjs +105 -0
- package/out/fsc/test.f.mjs +19 -0
- package/out/fsm/module.f.d.mts +14 -0
- package/out/fsm/module.f.mjs +80 -0
- package/out/fsm/test.f.mjs +138 -0
- package/out/html/module.f.d.mts +15 -0
- package/out/html/module.f.mjs +94 -0
- package/out/html/test.f.mjs +45 -0
- package/out/issues/test.f.mjs +66 -0
- package/{js → out/js}/tokenizer/module.f.d.mts +10 -15
- package/out/js/tokenizer/module.f.mjs +686 -0
- package/out/js/tokenizer/test.f.mjs +844 -0
- package/out/json/module.f.d.mts +33 -0
- package/out/json/module.f.mjs +89 -0
- package/{json → out/json}/parser/module.f.d.mts +9 -13
- package/out/json/parser/module.f.mjs +224 -0
- package/out/json/parser/test.f.mjs +321 -0
- package/out/json/serializer/module.f.d.mts +36 -0
- package/out/json/serializer/module.f.mjs +67 -0
- package/out/json/serializer/test.f.mjs +87 -0
- package/out/json/test.f.mjs +61 -0
- package/out/json/tokenizer/module.f.d.mts +13 -0
- package/out/json/tokenizer/module.f.mjs +78 -0
- package/out/json/tokenizer/test.f.mjs +420 -0
- package/out/nanvm-lib/tests/test.f.mjs +87 -0
- package/out/nodejs/version/main.mjs +3 -0
- package/{nodejs → out/nodejs}/version/module.f.d.mts +4 -9
- package/out/nodejs/version/module.f.mjs +34 -0
- package/out/nodejs/version/test.f.mjs +97 -0
- package/{prime_field → out/prime_field}/module.f.d.mts +20 -23
- package/out/prime_field/module.f.mjs +87 -0
- package/out/prime_field/test.f.mjs +145 -0
- package/{secp → out/secp}/module.f.d.mts +27 -28
- package/out/secp/module.f.mjs +113 -0
- package/out/secp/test.f.mjs +63 -0
- package/out/sha2/module.f.d.mts +15 -0
- package/out/sha2/module.f.mjs +172 -0
- package/out/sha2/test.f.mjs +86 -0
- package/out/text/ascii/module.f.d.mts +70 -0
- package/out/text/ascii/module.f.mjs +154 -0
- package/out/text/ascii/test.f.mjs +14 -0
- package/out/text/module.f.d.mts +13 -0
- package/out/text/module.f.mjs +19 -0
- package/out/text/sgr/module.f.d.mts +12 -0
- package/out/text/sgr/module.f.mjs +17 -0
- package/out/text/test.f.mjs +19 -0
- package/out/text/utf16/module.f.d.mts +12 -0
- package/out/text/utf16/module.f.mjs +86 -0
- package/out/text/utf16/test.f.mjs +145 -0
- package/out/text/utf8/module.f.d.mts +10 -0
- package/out/text/utf8/module.f.mjs +126 -0
- package/out/text/utf8/test.f.mjs +175 -0
- package/{types → out/types}/array/module.f.d.mts +14 -24
- package/out/types/array/module.f.mjs +95 -0
- package/out/types/array/test.f.mjs +116 -0
- package/out/types/bigfloat/module.f.d.mts +6 -0
- package/out/types/bigfloat/module.f.mjs +77 -0
- package/out/types/bigfloat/test.f.mjs +349 -0
- package/out/types/bigint/module.f.d.mts +29 -0
- package/{types/bigint/module.f.d.mts → out/types/bigint/module.f.mjs} +64 -27
- package/out/types/bigint/test.f.mjs +192 -0
- package/{types → out/types}/btree/find/module.f.d.mts +20 -26
- package/out/types/btree/find/module.f.mjs +137 -0
- package/out/types/btree/find/test.f.mjs +156 -0
- package/out/types/btree/module.f.d.mts +5 -0
- package/out/types/btree/module.f.mjs +34 -0
- package/{types → out/types}/btree/remove/module.f.d.mts +7 -12
- package/out/types/btree/remove/module.f.mjs +209 -0
- package/out/types/btree/remove/test.f.mjs +638 -0
- package/{types → out/types}/btree/set/module.f.d.mts +3 -7
- package/out/types/btree/set/module.f.mjs +114 -0
- package/out/types/btree/set/test.f.mjs +390 -0
- package/out/types/btree/test.f.mjs +83 -0
- package/{types → out/types}/btree/types/module.f.d.mts +0 -2
- package/out/types/btree/types/module.f.mjs +50 -0
- package/out/types/byte_set/module.f.d.mts +25 -0
- package/out/types/byte_set/module.f.mjs +42 -0
- package/out/types/byte_set/test.f.mjs +123 -0
- package/{types → out/types}/function/compare/module.f.d.mts +9 -15
- package/out/types/function/compare/module.f.mjs +22 -0
- package/out/types/function/compare/test.f.mjs +8 -0
- package/{types → out/types}/function/module.f.d.mts +20 -27
- package/out/types/function/module.f.mjs +44 -0
- package/{types → out/types}/function/operator/module.f.d.mts +28 -43
- package/out/types/function/operator/module.f.mjs +60 -0
- package/out/types/function/test.f.mjs +15 -0
- package/out/types/list/module.f.d.mts +82 -0
- package/out/types/list/module.f.mjs +269 -0
- package/out/types/list/test.f.mjs +401 -0
- package/out/types/map/module.f.d.mts +21 -0
- package/out/types/map/module.f.mjs +54 -0
- package/out/types/map/test.f.mjs +115 -0
- package/out/types/nibble_set/module.f.d.mts +16 -0
- package/out/types/nibble_set/module.f.mjs +19 -0
- package/out/types/nibble_set/test.f.mjs +90 -0
- package/out/types/nullable/module.f.d.mts +9 -0
- package/out/types/nullable/module.f.mjs +9 -0
- package/out/types/nullable/test.f.mjs +12 -0
- package/out/types/number/module.f.d.mts +7 -0
- package/out/types/number/module.f.mjs +12 -0
- package/out/types/number/test.f.mjs +126 -0
- package/out/types/object/module.f.d.mts +22 -0
- package/out/types/object/module.f.mjs +27 -0
- package/out/types/object/test.f.mjs +17 -0
- package/out/types/range/module.f.d.mts +6 -0
- package/out/types/range/module.f.mjs +6 -0
- package/out/types/range/test.f.mjs +18 -0
- package/{types → out/types}/range_map/module.f.d.mts +9 -15
- package/out/types/range_map/module.f.mjs +84 -0
- package/out/types/range_map/test.f.mjs +201 -0
- package/out/types/result/module.d.mts +7 -0
- package/{types → out/types}/result/module.f.d.mts +6 -12
- package/out/types/result/module.f.mjs +25 -0
- package/out/types/result/module.mjs +16 -0
- package/{types → out/types}/sorted_list/module.f.d.mts +22 -28
- package/out/types/sorted_list/module.f.mjs +102 -0
- package/out/types/sorted_list/test.f.mjs +66 -0
- package/{types → out/types}/sorted_set/module.f.d.mts +6 -12
- package/out/types/sorted_set/module.f.mjs +29 -0
- package/out/types/sorted_set/test.f.mjs +80 -0
- package/out/types/string/module.f.d.mts +9 -0
- package/out/types/string/module.f.mjs +17 -0
- package/out/types/string/test.f.mjs +58 -0
- package/out/types/string_set/module.f.d.mts +13 -0
- package/out/types/string_set/module.f.mjs +29 -0
- package/out/types/string_set/test.f.mjs +65 -0
- package/package.json +5 -4
- package/prime_field/module.f.mjs +9 -12
- package/prime_field/test.f.mjs +1 -1
- package/secp/module.f.mjs +38 -39
- package/secp/test.f.mjs +4 -4
- package/sha2/module.f.mjs +7 -20
- package/sha2/test.f.mjs +4 -4
- package/text/ascii/module.f.mjs +5 -10
- package/text/ascii/test.f.mjs +3 -3
- package/text/module.f.mjs +7 -14
- package/text/sgr/module.f.mjs +2 -4
- package/text/test.f.mjs +3 -3
- package/text/utf16/module.f.mjs +17 -28
- package/text/utf16/test.f.mjs +5 -5
- package/text/utf8/module.f.mjs +9 -16
- package/text/utf8/test.f.mjs +4 -4
- package/tsconfig.json +2 -2
- package/types/array/module.f.mjs +8 -25
- package/types/array/test.f.mjs +3 -3
- package/types/bigfloat/module.f.mjs +3 -10
- package/types/bigfloat/test.f.mjs +1 -1
- package/types/bigint/module.f.mjs +11 -30
- package/types/bigint/test.f.mjs +1 -1
- package/types/btree/find/module.f.mjs +8 -17
- package/types/btree/find/test.f.mjs +7 -7
- package/types/btree/module.f.mjs +6 -11
- package/types/btree/remove/module.f.mjs +10 -17
- package/types/btree/remove/test.f.mjs +5 -5
- package/types/btree/set/module.f.mjs +4 -9
- package/types/btree/set/test.f.mjs +4 -4
- package/types/btree/test.f.mjs +9 -9
- package/types/btree/types/module.f.mjs +0 -2
- package/types/byte_set/module.f.mjs +14 -39
- package/types/byte_set/test.f.mjs +5 -5
- package/types/function/compare/module.f.mjs +3 -12
- package/types/function/compare/test.f.mjs +1 -1
- package/types/function/module.f.mjs +4 -15
- package/types/function/operator/module.f.mjs +14 -41
- package/types/function/test.f.mjs +1 -1
- package/types/list/module.f.mjs +45 -114
- package/types/list/test.f.mjs +10 -10
- package/types/map/module.f.mjs +15 -30
- package/types/map/test.f.mjs +2 -2
- package/types/nibble_set/module.f.mjs +7 -24
- package/types/nibble_set/test.f.mjs +2 -2
- package/types/nullable/module.f.mjs +2 -9
- package/types/nullable/test.f.mjs +1 -1
- package/types/number/module.f.mjs +8 -19
- package/types/number/test.f.mjs +1 -1
- package/types/object/module.f.mjs +9 -20
- package/types/object/test.f.mjs +1 -1
- package/types/range/module.f.mjs +2 -9
- package/types/range/test.f.mjs +1 -1
- package/types/range_map/module.f.mjs +9 -18
- package/types/range_map/test.f.mjs +32 -32
- package/types/result/module.f.mjs +3 -12
- package/types/result/module.mjs +2 -2
- package/types/sorted_list/module.f.mjs +10 -19
- package/types/sorted_list/test.f.mjs +7 -7
- package/types/sorted_set/module.f.mjs +7 -16
- package/types/sorted_set/test.f.mjs +7 -7
- package/types/string/module.f.mjs +10 -21
- package/types/string/test.f.mjs +2 -2
- package/types/string_set/module.f.mjs +12 -27
- package/types/string_set/test.f.mjs +1 -1
- package/com/cpp/module.f.d.mts +0 -8
- package/com/cs/module.f.d.mts +0 -8
- package/commonjs/build/module.f.d.mts +0 -24
- package/commonjs/module.d.mts +0 -7
- package/commonjs/package/dependencies/module.f.d.mts +0 -10
- package/commonjs/package/module.f.d.mts +0 -27
- package/dev/module.f.d.mts +0 -4
- package/djs/tokenizer/module.f.d.mts +0 -17
- package/fsc/module.f.d.mts +0 -12
- package/fsm/module.f.d.mts +0 -21
- package/html/module.f.d.mts +0 -20
- package/json/module.f.d.mts +0 -41
- package/json/serializer/module.f.d.mts +0 -45
- package/json/tokenizer/module.f.d.mts +0 -17
- package/sha2/module.f.d.mts +0 -23
- package/text/ascii/module.f.d.mts +0 -73
- package/text/module.f.d.mts +0 -18
- package/text/sgr/module.f.d.mts +0 -14
- package/text/utf16/module.f.d.mts +0 -19
- package/text/utf8/module.f.d.mts +0 -15
- package/types/bigfloat/module.f.d.mts +0 -11
- package/types/btree/module.f.d.mts +0 -9
- package/types/byte_set/module.f.d.mts +0 -38
- package/types/list/module.f.d.mts +0 -117
- package/types/map/module.f.d.mts +0 -30
- package/types/nibble_set/module.f.d.mts +0 -26
- package/types/nullable/module.f.d.mts +0 -14
- package/types/number/module.f.d.mts +0 -13
- package/types/object/module.f.d.mts +0 -29
- package/types/range/module.f.d.mts +0 -11
- package/types/result/module.d.mts +0 -7
- package/types/string/module.f.d.mts +0 -15
- package/types/string_set/module.f.d.mts +0 -21
- /package/{com → out/com}/cpp/test.f.d.mts +0 -0
- /package/{com → out/com}/cpp/testlib.f.d.mts +0 -0
- /package/{com → out/com}/cs/test.f.d.mts +0 -0
- /package/{com → out/com}/cs/testlib.f.d.mts +0 -0
- /package/{com → out/com}/rust/test.f.d.mts +0 -0
- /package/{com → out/com}/rust/testlib.f.d.mts +0 -0
- /package/{com → out/com}/test/build.d.mts +0 -0
- /package/{com → out/com}/types/testlib.f.d.mts +0 -0
- /package/{commonjs → out/commonjs}/build/test.f.d.mts +0 -0
- /package/{commonjs → out/commonjs}/package/dependencies/test.f.d.mts +0 -0
- /package/{commonjs → out/commonjs}/package/test.f.d.mts +0 -0
- /package/{commonjs → out/commonjs}/path/test.f.d.mts +0 -0
- /package/{commonjs → out/commonjs}/test.d.mts +0 -0
- /package/{dev → out/dev}/index.d.mts +0 -0
- /package/{dev → out/dev}/module.d.mts +0 -0
- /package/{dev → out/dev}/test.d.mts +0 -0
- /package/{dev → out/dev}/test.f.d.mts +0 -0
- /package/{djs → out/djs}/parser/test.f.d.mts +0 -0
- /package/{djs → out/djs}/test.f.d.mts +0 -0
- /package/{djs → out/djs}/tokenizer/test.f.d.mts +0 -0
- /package/{fsc → out/fsc}/test.f.d.mts +0 -0
- /package/{fsm → out/fsm}/test.f.d.mts +0 -0
- /package/{html → out/html}/test.f.d.mts +0 -0
- /package/{issues → out/issues}/test.f.d.mts +0 -0
- /package/{js → out/js}/tokenizer/test.f.d.mts +0 -0
- /package/{json → out/json}/parser/test.f.d.mts +0 -0
- /package/{json → out/json}/serializer/test.f.d.mts +0 -0
- /package/{json → out/json}/test.f.d.mts +0 -0
- /package/{json → out/json}/tokenizer/test.f.d.mts +0 -0
- /package/{nanvm-lib → out/nanvm-lib}/tests/test.f.d.mts +0 -0
- /package/{nodejs → out/nodejs}/version/main.d.mts +0 -0
- /package/{nodejs → out/nodejs}/version/test.f.d.mts +0 -0
- /package/{prime_field → out/prime_field}/test.f.d.mts +0 -0
- /package/{secp → out/secp}/test.f.d.mts +0 -0
- /package/{sha2 → out/sha2}/test.f.d.mts +0 -0
- /package/{text → out/text}/ascii/test.f.d.mts +0 -0
- /package/{text → out/text}/test.f.d.mts +0 -0
- /package/{text → out/text}/utf16/test.f.d.mts +0 -0
- /package/{text → out/text}/utf8/test.f.d.mts +0 -0
- /package/{types → out/types}/array/test.f.d.mts +0 -0
- /package/{types → out/types}/bigfloat/test.f.d.mts +0 -0
- /package/{types → out/types}/bigint/test.f.d.mts +0 -0
- /package/{types → out/types}/btree/find/test.f.d.mts +0 -0
- /package/{types → out/types}/btree/remove/test.f.d.mts +0 -0
- /package/{types → out/types}/btree/set/test.f.d.mts +0 -0
- /package/{types → out/types}/btree/test.f.d.mts +0 -0
- /package/{types → out/types}/byte_set/test.f.d.mts +0 -0
- /package/{types → out/types}/function/compare/test.f.d.mts +0 -0
- /package/{types → out/types}/function/test.f.d.mts +0 -0
- /package/{types → out/types}/list/test.f.d.mts +0 -0
- /package/{types → out/types}/map/test.f.d.mts +0 -0
- /package/{types → out/types}/nibble_set/test.f.d.mts +0 -0
- /package/{types → out/types}/nullable/test.f.d.mts +0 -0
- /package/{types → out/types}/number/test.f.d.mts +0 -0
- /package/{types → out/types}/object/test.f.d.mts +0 -0
- /package/{types → out/types}/range/test.f.d.mts +0 -0
- /package/{types → out/types}/range_map/test.f.d.mts +0 -0
- /package/{types → out/types}/sorted_list/test.f.d.mts +0 -0
- /package/{types → out/types}/sorted_set/test.f.d.mts +0 -0
- /package/{types → out/types}/string/test.f.d.mts +0 -0
- /package/{types → out/types}/string_set/test.f.d.mts +0 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import * as _ from './module.f.mjs';
|
|
2
|
+
const { sum, abs, serialize, log2, bitLength } = _;
|
|
3
|
+
export default {
|
|
4
|
+
sum: () => {
|
|
5
|
+
const result = sum([2n, 3n, 4n, 5n]);
|
|
6
|
+
if (result !== 14n) {
|
|
7
|
+
throw result;
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
abs: [
|
|
11
|
+
() => {
|
|
12
|
+
const result = abs(10n);
|
|
13
|
+
if (result !== 10n) {
|
|
14
|
+
throw result;
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
() => {
|
|
18
|
+
const result = abs(-10n);
|
|
19
|
+
if (result !== 10n) {
|
|
20
|
+
throw result;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
serialize: [
|
|
25
|
+
() => {
|
|
26
|
+
const result = serialize(0n);
|
|
27
|
+
if (result !== '0n') {
|
|
28
|
+
throw result;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
() => {
|
|
32
|
+
const result = serialize(123456789012345678901234567890n);
|
|
33
|
+
if (result !== '123456789012345678901234567890n') {
|
|
34
|
+
throw result;
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
() => {
|
|
38
|
+
const result = serialize(-55555n);
|
|
39
|
+
if (result !== '-55555n') {
|
|
40
|
+
throw result;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
log2: [
|
|
45
|
+
() => {
|
|
46
|
+
const result = log2(-3n);
|
|
47
|
+
if (result !== -1n) {
|
|
48
|
+
throw result;
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
() => {
|
|
52
|
+
const result = log2(0n);
|
|
53
|
+
if (result !== -1n) {
|
|
54
|
+
throw result;
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
() => {
|
|
58
|
+
const result = log2(1n);
|
|
59
|
+
if (result !== 0n) {
|
|
60
|
+
throw result;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
() => {
|
|
64
|
+
const result = log2(2n);
|
|
65
|
+
if (result !== 1n) {
|
|
66
|
+
throw result;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
() => {
|
|
70
|
+
const result = log2(3n);
|
|
71
|
+
if (result !== 1n) {
|
|
72
|
+
throw result;
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
() => {
|
|
76
|
+
const result = log2(4n);
|
|
77
|
+
if (result !== 2n) {
|
|
78
|
+
throw result;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
() => {
|
|
82
|
+
const result = log2(7n);
|
|
83
|
+
if (result !== 2n) {
|
|
84
|
+
throw result;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
() => {
|
|
88
|
+
const result = log2(8n);
|
|
89
|
+
if (result !== 3n) {
|
|
90
|
+
throw result;
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
() => {
|
|
94
|
+
const result = log2(15n);
|
|
95
|
+
if (result !== 3n) {
|
|
96
|
+
throw result;
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
() => {
|
|
100
|
+
const result = log2(16n);
|
|
101
|
+
if (result !== 4n) {
|
|
102
|
+
throw result;
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
() => {
|
|
106
|
+
// max for Bun (131_072 Bytes)
|
|
107
|
+
const v = 1048575n;
|
|
108
|
+
const result = log2(1n << v);
|
|
109
|
+
if (result !== v) {
|
|
110
|
+
throw result;
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
toString2: () => {
|
|
115
|
+
// max for Bun (131_072 Bytes)
|
|
116
|
+
const v = 1048575n;
|
|
117
|
+
const result = (1n << v).toString(2).length - 1;
|
|
118
|
+
if (result !== 1_048_575) {
|
|
119
|
+
throw result;
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
minus: () => {
|
|
123
|
+
let i = 0n;
|
|
124
|
+
while (i < 1048575n) {
|
|
125
|
+
const s = -i;
|
|
126
|
+
if (i !== -s) {
|
|
127
|
+
throw [i, s];
|
|
128
|
+
}
|
|
129
|
+
i += 1n;
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
not: () => {
|
|
133
|
+
let i = 0n;
|
|
134
|
+
while (i < 1048575n) {
|
|
135
|
+
const s = ~i;
|
|
136
|
+
if (i !== ~s) {
|
|
137
|
+
throw [i, s];
|
|
138
|
+
}
|
|
139
|
+
i += 1n;
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
bitLen: {
|
|
143
|
+
0: () => {
|
|
144
|
+
const s = bitLength(0n);
|
|
145
|
+
if (s !== 0n) {
|
|
146
|
+
throw s;
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
m: () => {
|
|
150
|
+
let i = 0n;
|
|
151
|
+
while (i < 10000n) {
|
|
152
|
+
const s = bitLength(1n << i);
|
|
153
|
+
if (s !== i + 1n) {
|
|
154
|
+
throw [s, i];
|
|
155
|
+
}
|
|
156
|
+
i += 1n;
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
big: () => {
|
|
160
|
+
const s = bitLength(1n << 1000000n);
|
|
161
|
+
if (s !== 1000001n) {
|
|
162
|
+
throw s;
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
neg: [
|
|
166
|
+
() => {
|
|
167
|
+
const s = bitLength(-1n);
|
|
168
|
+
if (s !== 1n) {
|
|
169
|
+
throw s;
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
() => {
|
|
173
|
+
const s = bitLength(-2n);
|
|
174
|
+
if (s !== 2n) {
|
|
175
|
+
throw s;
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
() => {
|
|
179
|
+
const s = bitLength(-3n);
|
|
180
|
+
if (s !== 2n) {
|
|
181
|
+
throw s;
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
() => {
|
|
185
|
+
const s = bitLength(-4n);
|
|
186
|
+
if (s !== 3n) {
|
|
187
|
+
throw s;
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
};
|
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @template T
|
|
3
|
+
* @typedef {List.List<PathItem<T>>} Path
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @template T
|
|
7
|
+
* @typedef {{
|
|
8
|
+
* readonly first: First<T>,
|
|
9
|
+
* readonly tail: Path<T>
|
|
10
|
+
* }} Result<T>
|
|
11
|
+
*/
|
|
12
|
+
/** @type {<T>(c: cmp.Compare<T>) => (node: _.Node<T>) => Result<T>} */
|
|
13
|
+
export const find: <T>(c: cmp.Compare<T>) => (node: _.Node<T>) => Result<T>;
|
|
14
|
+
/** @type {<T>(first: First<T>) => boolean} */
|
|
15
|
+
export const isFound: <T>(first: First<T>) => boolean;
|
|
16
|
+
/** @type {<T>(first: First<T>) => T | null} */
|
|
17
|
+
export const value: <T>(first: First<T>) => T | null;
|
|
18
|
+
export type FirstLeaf1<T> = readonly [cmp.Index3, _.Leaf1<T>];
|
|
8
19
|
export type FirstBranch3<T> = readonly [1, _.Branch3<T>];
|
|
9
|
-
export type FirstLeaf2<T> = readonly [
|
|
20
|
+
export type FirstLeaf2<T> = readonly [cmp.Index5, _.Leaf2<T>];
|
|
10
21
|
export type FirstBranch5<T> = readonly [1 | 3, _.Branch5<T>];
|
|
11
22
|
export type First<T> = FirstLeaf1<T> | FirstBranch3<T> | FirstLeaf2<T> | FirstBranch5<T>;
|
|
12
23
|
export type PathItem3<T> = readonly [0 | 2, _.Branch3<T>];
|
|
@@ -20,23 +31,6 @@ export type Result<T> = {
|
|
|
20
31
|
readonly first: First<T>;
|
|
21
32
|
readonly tail: Path<T>;
|
|
22
33
|
};
|
|
23
|
-
|
|
24
|
-
* @template T
|
|
25
|
-
* @typedef {List.List<PathItem<T>>} Path
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* @template T
|
|
29
|
-
* @typedef {{
|
|
30
|
-
* readonly first: First<T>,
|
|
31
|
-
* readonly tail: Path<T>
|
|
32
|
-
* }} Result<T>
|
|
33
|
-
*/
|
|
34
|
-
/** @type {<T>(c: cmpT.Compare<T>) => (node: _.Node<T>) => Result<T>} */
|
|
35
|
-
declare const find: <T>(c: cmpT.Compare<T>) => (node: _.Node<T>) => Result<T>;
|
|
36
|
-
/** @type {<T>(first: First<T>) => T | null} */
|
|
37
|
-
declare const value: <T>(first: First<T>) => T | null;
|
|
38
|
-
/** @type {<T>(first: First<T>) => boolean} */
|
|
39
|
-
declare const isFound: <T>(first: First<T>) => boolean;
|
|
40
|
-
import * as cmpT from '../../function/compare/module.f.mjs';
|
|
34
|
+
import * as cmp from '../../function/compare/module.f.mjs';
|
|
41
35
|
import * as _ from '../types/module.f.mjs';
|
|
42
36
|
import * as List from '../../list/module.f.mjs';
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// @ts-self-types="./module.f.d.mts"
|
|
2
|
+
import * as _ from '../types/module.f.mjs';
|
|
3
|
+
import * as List from '../../list/module.f.mjs';
|
|
4
|
+
import * as cmp from '../../function/compare/module.f.mjs';
|
|
5
|
+
const { index3, index5 } = cmp;
|
|
6
|
+
import * as Array from '../../array/module.f.mjs';
|
|
7
|
+
/**
|
|
8
|
+
* @template T
|
|
9
|
+
* @typedef {readonly[cmp.Index3, _.Leaf1<T>]} FirstLeaf1
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* @template T
|
|
13
|
+
* @typedef {readonly[1, _.Branch3<T>]} FirstBranch3
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @template T
|
|
17
|
+
* @typedef {readonly[cmp.Index5, _.Leaf2<T>]} FirstLeaf2
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* @template T
|
|
21
|
+
* @typedef {readonly[1|3, _.Branch5<T>]} FirstBranch5
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* @template T
|
|
25
|
+
* @typedef {FirstLeaf1<T> | FirstBranch3<T> | FirstLeaf2<T> | FirstBranch5<T>} First
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* @template T
|
|
29
|
+
* @typedef {readonly[0|2, _.Branch3<T>]} PathItem3
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* @template T
|
|
33
|
+
* @typedef {readonly[0|2|4, _.Branch5<T>]} PathItem5
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* @template T
|
|
37
|
+
* @typedef {PathItem3<T> | PathItem5<T>} PathItem
|
|
38
|
+
*/
|
|
39
|
+
/** @type {<T>(item: PathItem<T>) => _.Node<T>} */
|
|
40
|
+
const child = item =>
|
|
41
|
+
/** @type {typeof item extends PathItem<infer T> ? _.Node<T> : never} */ (item[1][item[0]]);
|
|
42
|
+
/**
|
|
43
|
+
* @template T
|
|
44
|
+
* @typedef {List.List<PathItem<T>>} Path
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* @template T
|
|
48
|
+
* @typedef {{
|
|
49
|
+
* readonly first: First<T>,
|
|
50
|
+
* readonly tail: Path<T>
|
|
51
|
+
* }} Result<T>
|
|
52
|
+
*/
|
|
53
|
+
/** @type {<T>(c: cmp.Compare<T>) => (node: _.Node<T>) => Result<T>} */
|
|
54
|
+
export const find = c => {
|
|
55
|
+
const i3 = index3(c);
|
|
56
|
+
const i5 = index5(c);
|
|
57
|
+
/** @typedef {typeof c extends cmp.Compare<infer T> ? T : never} T */
|
|
58
|
+
/** @type {(prior: Path<T>) => (node: _.Node<T>) => Result<T>} */
|
|
59
|
+
const f = tail => node => {
|
|
60
|
+
/** @type {(index: Array.KeyOf<typeof node>) => Result<T>} */
|
|
61
|
+
const append = index => {
|
|
62
|
+
const first = /** @type {PathItem<T>} */ ([index, node]);
|
|
63
|
+
return f({ first, tail })(child(first));
|
|
64
|
+
};
|
|
65
|
+
/** @type {(index: Array.KeyOf<typeof node>) => Result<T>} */
|
|
66
|
+
const done = index => ({ first: /** @type {First<T>} */ ([index, node]), tail });
|
|
67
|
+
switch (node.length) {
|
|
68
|
+
case 1: {
|
|
69
|
+
return done(i3(node[0]));
|
|
70
|
+
}
|
|
71
|
+
case 2: {
|
|
72
|
+
return done(i5(node));
|
|
73
|
+
}
|
|
74
|
+
case 3: {
|
|
75
|
+
const i = i3(node[1]);
|
|
76
|
+
switch (i) {
|
|
77
|
+
case 0:
|
|
78
|
+
case 2: {
|
|
79
|
+
return append(i);
|
|
80
|
+
}
|
|
81
|
+
case 1: {
|
|
82
|
+
return done(i);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
case 5: {
|
|
87
|
+
const i = i5([node[1], node[3]]);
|
|
88
|
+
switch (i) {
|
|
89
|
+
case 0:
|
|
90
|
+
case 2:
|
|
91
|
+
case 4: {
|
|
92
|
+
return append(i);
|
|
93
|
+
}
|
|
94
|
+
case 1:
|
|
95
|
+
case 3: {
|
|
96
|
+
return done(i);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return f(null);
|
|
103
|
+
};
|
|
104
|
+
/** @type {<T>(first: First<T>) => boolean} */
|
|
105
|
+
export const isFound = ([i]) => {
|
|
106
|
+
switch (i) {
|
|
107
|
+
case 1:
|
|
108
|
+
case 3: {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
default: {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
/** @type {<T>(first: First<T>) => T | null} */
|
|
117
|
+
export const value = ([i, r]) => {
|
|
118
|
+
switch (i) {
|
|
119
|
+
case 1: {
|
|
120
|
+
switch (r.length) {
|
|
121
|
+
case 1:
|
|
122
|
+
case 2: {
|
|
123
|
+
return r[0];
|
|
124
|
+
}
|
|
125
|
+
default: {
|
|
126
|
+
return r[1];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
case 3: {
|
|
131
|
+
return r.length === 2 ? r[1] : r[3];
|
|
132
|
+
}
|
|
133
|
+
default: {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import * as _ from './module.f.mjs';
|
|
2
|
+
import * as list from '../../list/module.f.mjs';
|
|
3
|
+
import * as json from '../../../json/module.f.mjs';
|
|
4
|
+
import * as o from '../../object/module.f.mjs';
|
|
5
|
+
const { sort } = o;
|
|
6
|
+
import * as btree from '../types/module.f.mjs';
|
|
7
|
+
import * as string from '../../string/module.f.mjs';
|
|
8
|
+
const { cmp } = string;
|
|
9
|
+
import * as s from '../set/module.f.mjs';
|
|
10
|
+
const jsonStr = json.stringify(sort);
|
|
11
|
+
/** @type {(node: btree.Node<string>) => (value: string) => btree.Node<string>} */
|
|
12
|
+
const set = node => value => s.set(cmp(value))(() => value)(node);
|
|
13
|
+
/** @type {(r: _.Result<json.Unknown>) => string} */
|
|
14
|
+
const str = r => jsonStr(list.toArray(list.map(x => x[0])(r)));
|
|
15
|
+
/** @type {(i: string) => (m: btree.Node<string>) => string} */
|
|
16
|
+
const find = i => m => str(_.find(cmp(i))(m));
|
|
17
|
+
const test = () => {
|
|
18
|
+
/** @type {btree.Node<string>} */
|
|
19
|
+
let _map = ['1'];
|
|
20
|
+
for (let i = 2; i <= 10; i++)
|
|
21
|
+
_map = set(_map)((i * i).toString());
|
|
22
|
+
{
|
|
23
|
+
const s = jsonStr(_map);
|
|
24
|
+
if (s !== '[[["1","100"],"16",["25","36"]],"4",[["49"],"64",["81","9"]]]') {
|
|
25
|
+
throw s;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//
|
|
29
|
+
{
|
|
30
|
+
const r = find("0")(_map);
|
|
31
|
+
if (r !== '[0,0,0]') {
|
|
32
|
+
throw r;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
{
|
|
36
|
+
const r = find("1")(_map);
|
|
37
|
+
if (r !== '[1,0,0]') {
|
|
38
|
+
throw r;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
{
|
|
42
|
+
const r = find("10")(_map);
|
|
43
|
+
if (r !== '[2,0,0]') {
|
|
44
|
+
throw r;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
{
|
|
48
|
+
const r = find("100")(_map);
|
|
49
|
+
if (r !== '[3,0,0]') {
|
|
50
|
+
throw r;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
{
|
|
54
|
+
const r = find("12")(_map);
|
|
55
|
+
if (r !== '[4,0,0]') {
|
|
56
|
+
throw r;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
{
|
|
60
|
+
const r = find("16")(_map);
|
|
61
|
+
if (r !== '[1,0]') {
|
|
62
|
+
throw r;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
{
|
|
66
|
+
const r = find("17")(_map);
|
|
67
|
+
if (r !== '[0,2,0]') {
|
|
68
|
+
throw r;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
{
|
|
72
|
+
const r = find("25")(_map);
|
|
73
|
+
if (r !== '[1,2,0]') {
|
|
74
|
+
throw r;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
{
|
|
78
|
+
const r = find("26")(_map);
|
|
79
|
+
if (r !== '[2,2,0]') {
|
|
80
|
+
throw r;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
{
|
|
84
|
+
const r = find("36")(_map);
|
|
85
|
+
if (r !== '[3,2,0]') {
|
|
86
|
+
throw r;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
{
|
|
90
|
+
const r = find("37")(_map);
|
|
91
|
+
if (r !== '[4,2,0]') {
|
|
92
|
+
throw r;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
{
|
|
96
|
+
const r = find("4")(_map);
|
|
97
|
+
if (r !== '[1]') {
|
|
98
|
+
throw r;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
{
|
|
102
|
+
const r = find("41")(_map);
|
|
103
|
+
if (r !== '[0,0,2]') {
|
|
104
|
+
throw r;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
{
|
|
108
|
+
const r = find("49")(_map);
|
|
109
|
+
if (r !== '[1,0,2]') {
|
|
110
|
+
throw r;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
{
|
|
114
|
+
const r = find("5")(_map);
|
|
115
|
+
if (r !== '[2,0,2]') {
|
|
116
|
+
throw r;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
{
|
|
120
|
+
const r = find("64")(_map);
|
|
121
|
+
if (r !== '[1,2]') {
|
|
122
|
+
throw r;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
{
|
|
126
|
+
const r = find("65")(_map);
|
|
127
|
+
if (r !== '[0,2,2]') {
|
|
128
|
+
throw r;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
{
|
|
132
|
+
const r = find("81")(_map);
|
|
133
|
+
if (r !== '[1,2,2]') {
|
|
134
|
+
throw r;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
{
|
|
138
|
+
const r = find("85")(_map);
|
|
139
|
+
if (r !== '[2,2,2]') {
|
|
140
|
+
throw r;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
{
|
|
144
|
+
const r = find("9")(_map);
|
|
145
|
+
if (r !== '[3,2,2]') {
|
|
146
|
+
throw r;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
{
|
|
150
|
+
const r = find("91")(_map);
|
|
151
|
+
if (r !== '[4,2,2]') {
|
|
152
|
+
throw r;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
export default test;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// @ts-self-types="./module.f.d.mts"
|
|
2
|
+
import * as list from '../list/module.f.mjs';
|
|
3
|
+
const { flat } = list;
|
|
4
|
+
import * as n from '../nullable/module.f.mjs';
|
|
5
|
+
const { map } = n;
|
|
6
|
+
import * as _ from './types/module.f.mjs';
|
|
7
|
+
/** @type {<T>(node: _.Node<T>) => list.Thunk<T>} */
|
|
8
|
+
const nodeValues = node => () => {
|
|
9
|
+
switch (node.length) {
|
|
10
|
+
case 1:
|
|
11
|
+
case 2: {
|
|
12
|
+
return node;
|
|
13
|
+
}
|
|
14
|
+
case 3: {
|
|
15
|
+
return flat([
|
|
16
|
+
nodeValues(node[0]),
|
|
17
|
+
[node[1]],
|
|
18
|
+
nodeValues(node[2])
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
21
|
+
default: {
|
|
22
|
+
return flat([
|
|
23
|
+
nodeValues(node[0]),
|
|
24
|
+
[node[1]],
|
|
25
|
+
nodeValues(node[2]),
|
|
26
|
+
[node[3]],
|
|
27
|
+
nodeValues(node[4])
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export const empty = null;
|
|
33
|
+
/** @type {<T>(tree: _.Tree<T>) => list.List<T>} */
|
|
34
|
+
export const values = map(nodeValues);
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export default _default;
|
|
1
|
+
/** @type {<T>(c: Cmp.Compare<T>) => (node: _.Node<T>) => _.Tree<T>} */
|
|
2
|
+
export const nodeRemove: <T>(c: Cmp.Compare<T>) => (node: _.Node<T>) => _.Tree<T>;
|
|
3
|
+
/** @type {<T>(c: Cmp.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>} */
|
|
4
|
+
export const remove: <T>(c: Cmp.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>;
|
|
6
5
|
export type Leaf01<T> = null | _.Leaf1<T>;
|
|
7
6
|
export type RemovePath<T> = {
|
|
8
7
|
readonly first: Leaf01<T>;
|
|
9
|
-
readonly tail:
|
|
8
|
+
readonly tail: find.Path<T>;
|
|
10
9
|
};
|
|
11
10
|
export type Branch<T> = _.Branch1<T> | _.Branch3<T> | _.Branch5<T>;
|
|
12
11
|
export type Merge<A, T> = (a: A) => (n: _.Branch3<T>) => _.Branch1<T> | _.Branch3<T>;
|
|
13
|
-
/** @type {<T>(c: Cmp.Compare<T>) => (node: _.Node<T>) => _.Tree<T>} */
|
|
14
|
-
declare const nodeRemove: <T>(c: Cmp.Compare<T>) => (node: _.Node<T>) => _.Tree<T>;
|
|
15
|
-
/** @type {<T>(c: Cmp.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>} */
|
|
16
|
-
declare const remove: <T>(c: Cmp.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>;
|
|
17
|
-
import * as _ from '../types/module.f.mjs';
|
|
18
|
-
import * as Find from '../find/module.f.mjs';
|
|
19
12
|
import * as Cmp from '../../function/compare/module.f.mjs';
|
|
13
|
+
import * as _ from '../types/module.f.mjs';
|
|
14
|
+
import * as find from '../find/module.f.mjs';
|