kumi 0.0.18 → 0.0.20
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/.ruby-version +1 -0
- data/CHANGELOG.md +27 -0
- data/CLAUDE.md +26 -139
- data/README.md +143 -372
- data/data/functions/agg/boolean.yaml +14 -0
- data/data/functions/agg/numeric.yaml +80 -0
- data/data/functions/agg/string.yaml +8 -0
- data/data/functions/core/arithmetic.yaml +50 -0
- data/data/functions/core/boolean.yaml +18 -0
- data/data/functions/core/comparison.yaml +42 -0
- data/data/functions/core/constructor.yaml +32 -0
- data/data/functions/core/select.yaml +7 -0
- data/data/functions/core/stencil.yaml +21 -0
- data/data/functions/core/string.yaml +19 -0
- data/data/kernels/javascript/agg/boolean.yaml +12 -0
- data/data/kernels/javascript/agg/numeric.yaml +27 -0
- data/data/kernels/javascript/agg/string.yaml +5 -0
- data/data/kernels/javascript/core/arithmetic.yaml +32 -0
- data/data/kernels/javascript/core/boolean.yaml +12 -0
- data/data/kernels/javascript/core/comparison.yaml +24 -0
- data/data/kernels/javascript/core/constructor.yaml +15 -0
- data/data/kernels/javascript/core/select.yaml +7 -0
- data/data/kernels/javascript/core/string.yaml +12 -0
- data/data/kernels/ruby/agg/boolean.yaml +18 -0
- data/data/kernels/ruby/agg/numeric.yaml +29 -0
- data/data/kernels/ruby/agg/string.yaml +5 -0
- data/data/kernels/ruby/core/arithmetic.yaml +38 -0
- data/data/kernels/ruby/core/boolean.yaml +15 -0
- data/data/kernels/ruby/core/comparison.yaml +30 -0
- data/data/kernels/ruby/core/constructor.yaml +17 -0
- data/data/kernels/ruby/core/select.yaml +4 -0
- data/data/kernels/ruby/core/string.yaml +15 -0
- data/debug_ordering.rb +52 -0
- data/docs/FORM_SCHEMA.md +85 -0
- data/docs/OUTPUT_SCHEMA.md +69 -0
- data/docs/SYNTAX.md +626 -373
- data/golden/array_element/expected/ast.txt +21 -0
- data/golden/array_element/expected/input_plan.txt +5 -0
- data/golden/array_element/expected/lir_00_unoptimized.txt +13 -0
- data/golden/array_element/expected/lir_01_hoist_scalar_references.txt +13 -0
- data/golden/array_element/expected/lir_02_inlined.txt +13 -0
- data/golden/array_element/expected/lir_03_cse.txt +13 -0
- data/golden/array_element/expected/lir_04_1_loop_fusion.txt +13 -0
- data/golden/array_element/expected/lir_04_loop_invcm.txt +13 -0
- data/golden/array_element/expected/lir_06_const_prop.txt +13 -0
- data/golden/array_element/expected/nast.txt +7 -0
- data/golden/array_element/expected/schema_javascript.mjs +13 -0
- data/golden/array_element/expected/schema_ruby.rb +41 -0
- data/golden/array_element/expected/snast.txt +7 -0
- data/golden/array_element/expected.json +5 -0
- data/golden/array_element/input.json +9 -0
- data/golden/array_element/schema.kumi +11 -0
- data/golden/array_index/expected/ast.txt +59 -0
- data/golden/array_index/expected/input_plan.txt +5 -0
- data/golden/array_index/expected/lir_00_unoptimized.txt +41 -0
- data/golden/array_index/expected/lir_01_hoist_scalar_references.txt +41 -0
- data/golden/array_index/expected/lir_02_inlined.txt +42 -0
- data/golden/array_index/expected/lir_03_cse.txt +40 -0
- data/golden/array_index/expected/lir_04_1_loop_fusion.txt +40 -0
- data/golden/array_index/expected/lir_04_loop_invcm.txt +40 -0
- data/golden/array_index/expected/lir_06_const_prop.txt +40 -0
- data/golden/array_index/expected/nast.txt +33 -0
- data/golden/array_index/expected/schema_javascript.mjs +46 -0
- data/golden/array_index/expected/schema_ruby.rb +75 -0
- data/golden/array_index/expected/snast.txt +33 -0
- data/golden/array_index/expected.json +5 -0
- data/golden/array_index/input.json +1 -0
- data/golden/array_index/schema.kumi +19 -0
- data/golden/array_operations/expected/ast.txt +50 -0
- data/golden/array_operations/expected/input_plan.txt +10 -0
- data/golden/array_operations/expected/lir_00_unoptimized.txt +47 -0
- data/golden/array_operations/expected/lir_01_hoist_scalar_references.txt +47 -0
- data/golden/array_operations/expected/lir_02_inlined.txt +47 -0
- data/golden/array_operations/expected/lir_03_cse.txt +47 -0
- data/golden/array_operations/expected/lir_04_1_loop_fusion.txt +47 -0
- data/golden/array_operations/expected/lir_04_loop_invcm.txt +47 -0
- data/golden/array_operations/expected/lir_06_const_prop.txt +47 -0
- data/golden/array_operations/expected/nast.txt +32 -0
- data/golden/array_operations/expected/schema_javascript.mjs +60 -0
- data/golden/array_operations/expected/schema_ruby.rb +91 -0
- data/golden/array_operations/expected/snast.txt +32 -0
- data/golden/array_operations/expected.json +27 -0
- data/golden/array_operations/input.json +8 -0
- data/golden/array_operations/schema.kumi +12 -10
- data/golden/cascade_logic/expected/ast.txt +37 -0
- data/golden/cascade_logic/expected/input_plan.txt +2 -0
- data/golden/cascade_logic/expected/lir_00_unoptimized.txt +29 -0
- data/golden/cascade_logic/expected/lir_01_hoist_scalar_references.txt +29 -0
- data/golden/cascade_logic/expected/lir_02_inlined.txt +37 -0
- data/golden/cascade_logic/expected/lir_03_cse.txt +30 -0
- data/golden/cascade_logic/expected/lir_04_1_loop_fusion.txt +30 -0
- data/golden/cascade_logic/expected/lir_04_loop_invcm.txt +30 -0
- data/golden/cascade_logic/expected/lir_06_const_prop.txt +30 -0
- data/golden/cascade_logic/expected/nast.txt +32 -0
- data/golden/cascade_logic/expected/schema_javascript.mjs +31 -0
- data/golden/cascade_logic/expected/schema_ruby.rb +57 -0
- data/golden/cascade_logic/expected/snast.txt +32 -0
- data/golden/cascade_logic/expected.json +5 -0
- data/golden/cascade_logic/input.json +4 -0
- data/golden/cascade_logic/schema.kumi +1 -3
- data/golden/chained_fusion/expected/ast.txt +57 -0
- data/golden/chained_fusion/expected/input_plan.txt +13 -0
- data/golden/chained_fusion/expected/lir_00_unoptimized.txt +76 -0
- data/golden/chained_fusion/expected/lir_01_hoist_scalar_references.txt +76 -0
- data/golden/chained_fusion/expected/lir_02_inlined.txt +114 -0
- data/golden/chained_fusion/expected/lir_03_cse.txt +97 -0
- data/golden/chained_fusion/expected/lir_04_1_loop_fusion.txt +99 -0
- data/golden/chained_fusion/expected/lir_04_loop_invcm.txt +97 -0
- data/golden/chained_fusion/expected/lir_06_const_prop.txt +97 -0
- data/golden/chained_fusion/expected/nast.txt +55 -0
- data/golden/chained_fusion/expected/schema_javascript.mjs +116 -0
- data/golden/chained_fusion/expected/schema_ruby.rb +149 -0
- data/golden/chained_fusion/expected/snast.txt +55 -0
- data/golden/chained_fusion/expected.json +45 -0
- data/golden/chained_fusion/input.json +51 -0
- data/golden/chained_fusion/schema.kumi +52 -0
- data/golden/element_arrays/expected/ast.txt +55 -0
- data/golden/element_arrays/expected/input_plan.txt +7 -0
- data/golden/element_arrays/expected/lir_00_unoptimized.txt +81 -0
- data/golden/element_arrays/expected/lir_01_hoist_scalar_references.txt +81 -0
- data/golden/element_arrays/expected/lir_02_inlined.txt +85 -0
- data/golden/element_arrays/expected/lir_03_cse.txt +83 -0
- data/golden/element_arrays/expected/lir_04_1_loop_fusion.txt +83 -0
- data/golden/element_arrays/expected/lir_04_loop_invcm.txt +83 -0
- data/golden/element_arrays/expected/lir_06_const_prop.txt +83 -0
- data/golden/element_arrays/expected/nast.txt +42 -0
- data/golden/element_arrays/expected/schema_javascript.mjs +106 -0
- data/golden/element_arrays/expected/schema_ruby.rb +141 -0
- data/golden/element_arrays/expected/snast.txt +42 -0
- data/golden/element_arrays/expected.json +55 -0
- data/golden/element_arrays/input.json +12 -0
- data/golden/element_arrays/schema.kumi +21 -0
- data/golden/empty_and_null_inputs/expected/ast.txt +42 -0
- data/golden/empty_and_null_inputs/expected/input_plan.txt +12 -0
- data/golden/empty_and_null_inputs/expected/lir_00_unoptimized.txt +31 -0
- data/golden/empty_and_null_inputs/expected/lir_01_hoist_scalar_references.txt +31 -0
- data/golden/empty_and_null_inputs/expected/lir_02_inlined.txt +51 -0
- data/golden/empty_and_null_inputs/expected/lir_03_cse.txt +49 -0
- data/golden/empty_and_null_inputs/expected/lir_04_1_loop_fusion.txt +49 -0
- data/golden/empty_and_null_inputs/expected/lir_04_loop_invcm.txt +49 -0
- data/golden/empty_and_null_inputs/expected/lir_06_const_prop.txt +49 -0
- data/golden/empty_and_null_inputs/expected/nast.txt +18 -0
- data/golden/empty_and_null_inputs/expected/schema_javascript.mjs +47 -0
- data/golden/empty_and_null_inputs/expected/schema_ruby.rb +79 -0
- data/golden/empty_and_null_inputs/expected/snast.txt +18 -0
- data/golden/empty_and_null_inputs/expected.json +8 -0
- data/golden/empty_and_null_inputs/input.json +16 -0
- data/golden/empty_and_null_inputs/schema.kumi +30 -0
- data/golden/game_of_life/expected/ast.txt +118 -0
- data/golden/game_of_life/expected/input_plan.txt +5 -0
- data/golden/game_of_life/expected/lir_00_unoptimized.txt +343 -0
- data/golden/game_of_life/expected/lir_01_hoist_scalar_references.txt +343 -0
- data/golden/game_of_life/expected/lir_02_inlined.txt +1918 -0
- data/golden/game_of_life/expected/lir_03_cse.txt +766 -0
- data/golden/game_of_life/expected/lir_04_1_loop_fusion.txt +766 -0
- data/golden/game_of_life/expected/lir_04_loop_invcm.txt +766 -0
- data/golden/game_of_life/expected/lir_06_const_prop.txt +766 -0
- data/golden/game_of_life/expected/nast.txt +104 -0
- data/golden/game_of_life/expected/schema_javascript.mjs +98 -0
- data/golden/game_of_life/expected/schema_ruby.rb +125 -0
- data/golden/game_of_life/expected/snast.txt +104 -0
- data/golden/game_of_life/expected.json +3 -0
- data/golden/game_of_life/input.json +8 -0
- data/golden/game_of_life/schema.kumi +33 -0
- data/golden/hash_keys/expected/ast.txt +29 -0
- data/golden/hash_keys/expected/input_plan.txt +2 -0
- data/golden/hash_keys/expected/lir_00_unoptimized.txt +18 -0
- data/golden/hash_keys/expected/lir_01_hoist_scalar_references.txt +18 -0
- data/golden/hash_keys/expected/lir_02_inlined.txt +18 -0
- data/golden/hash_keys/expected/lir_03_cse.txt +18 -0
- data/golden/hash_keys/expected/lir_04_1_loop_fusion.txt +18 -0
- data/golden/hash_keys/expected/lir_04_loop_invcm.txt +18 -0
- data/golden/hash_keys/expected/lir_06_const_prop.txt +18 -0
- data/golden/hash_keys/expected/nast.txt +46 -0
- data/golden/hash_keys/expected/schema_javascript.mjs +34 -0
- data/golden/hash_keys/expected/schema_ruby.rb +61 -0
- data/golden/hash_keys/expected/snast.txt +46 -0
- data/golden/hash_keys/expected.json +20 -0
- data/golden/hash_keys/input.json +4 -0
- data/golden/hash_keys/schema.kumi +14 -0
- data/golden/hash_value/expected/ast.txt +37 -0
- data/golden/hash_value/expected/input_plan.txt +7 -0
- data/golden/hash_value/expected/lir_00_unoptimized.txt +30 -0
- data/golden/hash_value/expected/lir_01_hoist_scalar_references.txt +30 -0
- data/golden/hash_value/expected/lir_02_inlined.txt +36 -0
- data/golden/hash_value/expected/lir_03_cse.txt +33 -0
- data/golden/hash_value/expected/lir_04_1_loop_fusion.txt +33 -0
- data/golden/hash_value/expected/lir_04_loop_invcm.txt +33 -0
- data/golden/hash_value/expected/lir_06_const_prop.txt +33 -0
- data/golden/hash_value/expected/nast.txt +25 -0
- data/golden/hash_value/expected/schema_javascript.mjs +46 -0
- data/golden/hash_value/expected/schema_ruby.rb +75 -0
- data/golden/hash_value/expected/snast.txt +25 -0
- data/golden/hash_value/expected.json +19 -0
- data/golden/hash_value/input.json +12 -0
- data/golden/hash_value/schema.kumi +19 -0
- data/golden/hierarchical_complex/expected/ast.txt +85 -0
- data/golden/hierarchical_complex/expected/input_plan.txt +23 -0
- data/golden/hierarchical_complex/expected/lir_00_unoptimized.txt +87 -0
- data/golden/hierarchical_complex/expected/lir_01_hoist_scalar_references.txt +87 -0
- data/golden/hierarchical_complex/expected/lir_02_inlined.txt +115 -0
- data/golden/hierarchical_complex/expected/lir_03_cse.txt +89 -0
- data/golden/hierarchical_complex/expected/lir_04_1_loop_fusion.txt +89 -0
- data/golden/hierarchical_complex/expected/lir_04_loop_invcm.txt +89 -0
- data/golden/hierarchical_complex/expected/lir_06_const_prop.txt +89 -0
- data/golden/hierarchical_complex/expected/nast.txt +49 -0
- data/golden/hierarchical_complex/expected/schema_javascript.mjs +121 -0
- data/golden/hierarchical_complex/expected/schema_ruby.rb +151 -0
- data/golden/hierarchical_complex/expected/snast.txt +49 -0
- data/golden/hierarchical_complex/expected.json +34 -0
- data/golden/hierarchical_complex/input.json +26 -0
- data/golden/hierarchical_complex/schema.kumi +38 -0
- data/golden/input_reference/expected/ast.txt +46 -0
- data/golden/input_reference/expected/input_plan.txt +15 -0
- data/golden/input_reference/expected/lir_00_unoptimized.txt +39 -0
- data/golden/input_reference/expected/lir_01_hoist_scalar_references.txt +39 -0
- data/golden/input_reference/expected/lir_02_inlined.txt +39 -0
- data/golden/input_reference/expected/lir_03_cse.txt +39 -0
- data/golden/input_reference/expected/lir_04_1_loop_fusion.txt +39 -0
- data/golden/input_reference/expected/lir_04_loop_invcm.txt +39 -0
- data/golden/input_reference/expected/lir_06_const_prop.txt +39 -0
- data/golden/input_reference/expected/nast.txt +21 -0
- data/golden/input_reference/expected/schema_javascript.mjs +45 -0
- data/golden/input_reference/expected/schema_ruby.rb +74 -0
- data/golden/input_reference/expected/snast.txt +21 -0
- data/golden/input_reference/expected.json +7 -0
- data/golden/input_reference/input.json +11 -0
- data/golden/input_reference/schema.kumi +22 -0
- data/golden/interleaved_fusion/expected/ast.txt +51 -0
- data/golden/interleaved_fusion/expected/input_plan.txt +13 -0
- data/golden/interleaved_fusion/expected/lir_00_unoptimized.txt +53 -0
- data/golden/interleaved_fusion/expected/lir_01_hoist_scalar_references.txt +53 -0
- data/golden/interleaved_fusion/expected/lir_02_inlined.txt +89 -0
- data/golden/interleaved_fusion/expected/lir_03_cse.txt +77 -0
- data/golden/interleaved_fusion/expected/lir_04_1_loop_fusion.txt +77 -0
- data/golden/interleaved_fusion/expected/lir_04_loop_invcm.txt +77 -0
- data/golden/interleaved_fusion/expected/lir_06_const_prop.txt +77 -0
- data/golden/interleaved_fusion/expected/nast.txt +41 -0
- data/golden/interleaved_fusion/expected/schema_javascript.mjs +86 -0
- data/golden/interleaved_fusion/expected/schema_ruby.rb +122 -0
- data/golden/interleaved_fusion/expected/snast.txt +41 -0
- data/golden/interleaved_fusion/expected.json +37 -0
- data/golden/interleaved_fusion/input.json +26 -0
- data/golden/interleaved_fusion/schema.kumi +57 -0
- data/golden/let_inline/expected/ast.txt +33 -0
- data/golden/let_inline/expected/input_plan.txt +2 -0
- data/golden/let_inline/expected/lir_00_unoptimized.txt +26 -0
- data/golden/let_inline/expected/lir_01_hoist_scalar_references.txt +26 -0
- data/golden/let_inline/expected/lir_02_inlined.txt +36 -0
- data/golden/let_inline/expected/lir_03_cse.txt +30 -0
- data/golden/let_inline/expected/lir_04_1_loop_fusion.txt +30 -0
- data/golden/let_inline/expected/lir_04_loop_invcm.txt +30 -0
- data/golden/let_inline/expected/lir_06_const_prop.txt +30 -0
- data/golden/let_inline/expected/nast.txt +26 -0
- data/golden/let_inline/expected/schema_javascript.mjs +11 -0
- data/golden/let_inline/expected/schema_ruby.rb +37 -0
- data/golden/let_inline/expected/snast.txt +26 -0
- data/golden/let_inline/expected.json +1 -0
- data/golden/let_inline/input.json +1 -0
- data/golden/let_inline/schema.kumi +11 -0
- data/golden/loop_fusion/expected/ast.txt +44 -0
- data/golden/loop_fusion/expected/input_plan.txt +13 -0
- data/golden/loop_fusion/expected/lir_00_unoptimized.txt +43 -0
- data/golden/loop_fusion/expected/lir_01_hoist_scalar_references.txt +43 -0
- data/golden/loop_fusion/expected/lir_02_inlined.txt +62 -0
- data/golden/loop_fusion/expected/lir_03_cse.txt +57 -0
- data/golden/loop_fusion/expected/lir_04_1_loop_fusion.txt +57 -0
- data/golden/loop_fusion/expected/lir_04_loop_invcm.txt +57 -0
- data/golden/loop_fusion/expected/lir_06_const_prop.txt +57 -0
- data/golden/loop_fusion/expected/nast.txt +32 -0
- data/golden/loop_fusion/expected/schema_javascript.mjs +64 -0
- data/golden/loop_fusion/expected/schema_ruby.rb +97 -0
- data/golden/loop_fusion/expected/snast.txt +32 -0
- data/golden/loop_fusion/expected.json +30 -0
- data/golden/loop_fusion/input.json +28 -0
- data/golden/loop_fusion/schema.kumi +32 -0
- data/golden/min_reduce_scope/expected/ast.txt +49 -0
- data/golden/min_reduce_scope/expected/input_plan.txt +9 -0
- data/golden/min_reduce_scope/expected/lir_00_unoptimized.txt +59 -0
- data/golden/min_reduce_scope/expected/lir_01_hoist_scalar_references.txt +59 -0
- data/golden/min_reduce_scope/expected/lir_02_inlined.txt +63 -0
- data/golden/min_reduce_scope/expected/lir_03_cse.txt +60 -0
- data/golden/min_reduce_scope/expected/lir_04_1_loop_fusion.txt +60 -0
- data/golden/min_reduce_scope/expected/lir_04_loop_invcm.txt +60 -0
- data/golden/min_reduce_scope/expected/lir_06_const_prop.txt +60 -0
- data/golden/min_reduce_scope/expected/nast.txt +29 -0
- data/golden/min_reduce_scope/expected/schema_javascript.mjs +66 -0
- data/golden/min_reduce_scope/expected/schema_ruby.rb +99 -0
- data/golden/min_reduce_scope/expected/snast.txt +29 -0
- data/golden/min_reduce_scope/expected.json +9 -0
- data/golden/min_reduce_scope/input.json +18 -0
- data/golden/min_reduce_scope/schema.kumi +25 -0
- data/golden/mixed_dimensions/expected/ast.txt +54 -0
- data/golden/mixed_dimensions/expected/input_plan.txt +15 -0
- data/golden/mixed_dimensions/expected/lir_00_unoptimized.txt +42 -0
- data/golden/mixed_dimensions/expected/lir_01_hoist_scalar_references.txt +42 -0
- data/golden/mixed_dimensions/expected/lir_02_inlined.txt +48 -0
- data/golden/mixed_dimensions/expected/lir_03_cse.txt +48 -0
- data/golden/mixed_dimensions/expected/lir_04_1_loop_fusion.txt +48 -0
- data/golden/mixed_dimensions/expected/lir_04_loop_invcm.txt +48 -0
- data/golden/mixed_dimensions/expected/lir_06_const_prop.txt +48 -0
- data/golden/mixed_dimensions/expected/nast.txt +22 -0
- data/golden/mixed_dimensions/expected/schema_javascript.mjs +53 -0
- data/golden/mixed_dimensions/expected/schema_ruby.rb +84 -0
- data/golden/mixed_dimensions/expected/snast.txt +22 -0
- data/golden/mixed_dimensions/expected.json +6 -0
- data/golden/mixed_dimensions/input.json +22 -0
- data/golden/mixed_dimensions/schema.kumi +35 -0
- data/golden/multirank_hoisting/expected/ast.txt +72 -0
- data/golden/multirank_hoisting/expected/input_plan.txt +18 -0
- data/golden/multirank_hoisting/expected/lir_00_unoptimized.txt +75 -0
- data/golden/multirank_hoisting/expected/lir_01_hoist_scalar_references.txt +75 -0
- data/golden/multirank_hoisting/expected/lir_02_inlined.txt +126 -0
- data/golden/multirank_hoisting/expected/lir_03_cse.txt +109 -0
- data/golden/multirank_hoisting/expected/lir_04_1_loop_fusion.txt +109 -0
- data/golden/multirank_hoisting/expected/lir_04_loop_invcm.txt +109 -0
- data/golden/multirank_hoisting/expected/lir_06_const_prop.txt +109 -0
- data/golden/multirank_hoisting/expected/nast.txt +39 -0
- data/golden/multirank_hoisting/expected/schema_javascript.mjs +128 -0
- data/golden/multirank_hoisting/expected/schema_ruby.rb +162 -0
- data/golden/multirank_hoisting/expected/snast.txt +39 -0
- data/golden/multirank_hoisting/expected.json +15 -0
- data/golden/multirank_hoisting/input.json +19 -0
- data/golden/multirank_hoisting/schema.kumi +38 -0
- data/golden/nested_hash/expected/ast.txt +22 -0
- data/golden/nested_hash/expected/input_plan.txt +5 -0
- data/golden/nested_hash/expected/lir_00_unoptimized.txt +10 -0
- data/golden/nested_hash/expected/lir_01_hoist_scalar_references.txt +10 -0
- data/golden/nested_hash/expected/lir_02_inlined.txt +10 -0
- data/golden/nested_hash/expected/lir_03_cse.txt +10 -0
- data/golden/nested_hash/expected/lir_04_1_loop_fusion.txt +10 -0
- data/golden/nested_hash/expected/lir_04_loop_invcm.txt +10 -0
- data/golden/nested_hash/expected/lir_06_const_prop.txt +10 -0
- data/golden/nested_hash/expected/nast.txt +8 -0
- data/golden/nested_hash/expected/schema_javascript.mjs +9 -0
- data/golden/nested_hash/expected/schema_ruby.rb +35 -0
- data/golden/nested_hash/expected/snast.txt +8 -0
- data/golden/nested_hash/expected.json +3 -0
- data/golden/nested_hash/input.json +7 -0
- data/golden/nested_hash/schema.kumi +11 -0
- data/golden/reduction_broadcast/expected/ast.txt +49 -0
- data/golden/reduction_broadcast/expected/input_plan.txt +13 -0
- data/golden/reduction_broadcast/expected/lir_00_unoptimized.txt +49 -0
- data/golden/reduction_broadcast/expected/lir_01_hoist_scalar_references.txt +49 -0
- data/golden/reduction_broadcast/expected/lir_02_inlined.txt +80 -0
- data/golden/reduction_broadcast/expected/lir_03_cse.txt +68 -0
- data/golden/reduction_broadcast/expected/lir_04_1_loop_fusion.txt +68 -0
- data/golden/reduction_broadcast/expected/lir_04_loop_invcm.txt +68 -0
- data/golden/reduction_broadcast/expected/lir_06_const_prop.txt +68 -0
- data/golden/reduction_broadcast/expected/nast.txt +24 -0
- data/golden/reduction_broadcast/expected/schema_javascript.mjs +74 -0
- data/golden/reduction_broadcast/expected/schema_ruby.rb +110 -0
- data/golden/reduction_broadcast/expected/snast.txt +24 -0
- data/golden/reduction_broadcast/expected.json +25 -0
- data/golden/reduction_broadcast/input.json +19 -0
- data/golden/reduction_broadcast/schema.kumi +34 -0
- data/golden/roll/expected/ast.txt +36 -0
- data/golden/roll/expected/input_plan.txt +3 -0
- data/golden/roll/expected/lir_00_unoptimized.txt +56 -0
- data/golden/roll/expected/lir_01_hoist_scalar_references.txt +56 -0
- data/golden/roll/expected/lir_02_inlined.txt +56 -0
- data/golden/roll/expected/lir_03_cse.txt +55 -0
- data/golden/roll/expected/lir_04_1_loop_fusion.txt +55 -0
- data/golden/roll/expected/lir_04_loop_invcm.txt +55 -0
- data/golden/roll/expected/lir_06_const_prop.txt +55 -0
- data/golden/roll/expected/nast.txt +26 -0
- data/golden/roll/expected/schema_javascript.mjs +65 -0
- data/golden/roll/expected/schema_ruby.rb +95 -0
- data/golden/roll/expected/snast.txt +26 -0
- data/golden/roll/expected.json +6 -0
- data/golden/roll/input.json +1 -0
- data/golden/roll/schema.kumi +13 -0
- data/golden/shift/expected/ast.txt +48 -0
- data/golden/shift/expected/input_plan.txt +3 -0
- data/golden/shift/expected/lir_00_unoptimized.txt +96 -0
- data/golden/shift/expected/lir_01_hoist_scalar_references.txt +96 -0
- data/golden/shift/expected/lir_02_inlined.txt +96 -0
- data/golden/shift/expected/lir_03_cse.txt +90 -0
- data/golden/shift/expected/lir_04_1_loop_fusion.txt +90 -0
- data/golden/shift/expected/lir_04_loop_invcm.txt +90 -0
- data/golden/shift/expected/lir_06_const_prop.txt +90 -0
- data/golden/shift/expected/nast.txt +38 -0
- data/golden/shift/expected/schema_javascript.mjs +106 -0
- data/golden/shift/expected/schema_ruby.rb +138 -0
- data/golden/shift/expected/snast.txt +38 -0
- data/golden/shift/expected.json +8 -0
- data/golden/shift/input.json +1 -0
- data/golden/shift/schema.kumi +15 -0
- data/golden/shift_2d/expected/ast.txt +88 -0
- data/golden/shift_2d/expected/input_plan.txt +5 -0
- data/golden/shift_2d/expected/lir_00_unoptimized.txt +274 -0
- data/golden/shift_2d/expected/lir_01_hoist_scalar_references.txt +274 -0
- data/golden/shift_2d/expected/lir_02_inlined.txt +274 -0
- data/golden/shift_2d/expected/lir_03_cse.txt +262 -0
- data/golden/shift_2d/expected/lir_04_1_loop_fusion.txt +262 -0
- data/golden/shift_2d/expected/lir_04_loop_invcm.txt +262 -0
- data/golden/shift_2d/expected/lir_06_const_prop.txt +262 -0
- data/golden/shift_2d/expected/nast.txt +74 -0
- data/golden/shift_2d/expected/schema_javascript.mjs +320 -0
- data/golden/shift_2d/expected/schema_ruby.rb +358 -0
- data/golden/shift_2d/expected/snast.txt +74 -0
- data/golden/shift_2d/expected.json +15 -0
- data/golden/shift_2d/input.json +14 -0
- data/golden/shift_2d/schema.kumi +25 -0
- data/golden/simple_math/expected/ast.txt +40 -0
- data/golden/simple_math/expected/input_plan.txt +2 -0
- data/golden/simple_math/expected/lir_00_unoptimized.txt +31 -0
- data/golden/simple_math/expected/lir_01_hoist_scalar_references.txt +31 -0
- data/golden/simple_math/expected/lir_02_inlined.txt +31 -0
- data/golden/simple_math/expected/lir_03_cse.txt +31 -0
- data/golden/simple_math/expected/lir_04_1_loop_fusion.txt +31 -0
- data/golden/simple_math/expected/lir_04_loop_invcm.txt +31 -0
- data/golden/simple_math/expected/lir_06_const_prop.txt +31 -0
- data/golden/simple_math/expected/nast.txt +33 -0
- data/golden/simple_math/expected/schema_javascript.mjs +33 -0
- data/golden/simple_math/expected/schema_ruby.rb +59 -0
- data/golden/simple_math/expected/snast.txt +33 -0
- data/golden/simple_math/expected.json +1 -0
- data/golden/simple_math/input.json +4 -0
- data/golden/simple_math/schema.kumi +2 -1
- data/golden/streaming_basics/expected/ast.txt +64 -0
- data/golden/streaming_basics/expected/input_plan.txt +8 -0
- data/golden/streaming_basics/expected/lir_00_unoptimized.txt +73 -0
- data/golden/streaming_basics/expected/lir_01_hoist_scalar_references.txt +73 -0
- data/golden/streaming_basics/expected/lir_02_inlined.txt +100 -0
- data/golden/streaming_basics/expected/lir_03_cse.txt +84 -0
- data/golden/streaming_basics/expected/lir_04_1_loop_fusion.txt +84 -0
- data/golden/streaming_basics/expected/lir_04_loop_invcm.txt +84 -0
- data/golden/streaming_basics/expected/lir_06_const_prop.txt +84 -0
- data/golden/streaming_basics/expected/nast.txt +48 -0
- data/golden/streaming_basics/expected/schema_javascript.mjs +94 -0
- data/golden/streaming_basics/expected/schema_ruby.rb +127 -0
- data/golden/streaming_basics/expected/snast.txt +48 -0
- data/golden/streaming_basics/expected.json +10 -0
- data/golden/streaming_basics/input.json +8 -0
- data/golden/streaming_basics/schema.kumi +24 -0
- data/golden/tuples/expected/ast.txt +48 -0
- data/golden/tuples/expected/input_plan.txt +1 -0
- data/golden/tuples/expected/lir_00_unoptimized.txt +40 -0
- data/golden/tuples/expected/lir_01_hoist_scalar_references.txt +40 -0
- data/golden/tuples/expected/lir_02_inlined.txt +48 -0
- data/golden/tuples/expected/lir_03_cse.txt +48 -0
- data/golden/tuples/expected/lir_04_1_loop_fusion.txt +48 -0
- data/golden/tuples/expected/lir_04_loop_invcm.txt +48 -0
- data/golden/tuples/expected/lir_06_const_prop.txt +48 -0
- data/golden/tuples/expected/nast.txt +42 -0
- data/golden/tuples/expected/schema_javascript.mjs +51 -0
- data/golden/tuples/expected/schema_ruby.rb +77 -0
- data/golden/tuples/expected/snast.txt +42 -0
- data/golden/tuples/expected.json +7 -0
- data/golden/tuples/input.json +3 -0
- data/golden/tuples/schema.kumi +11 -0
- data/golden/tuples_and_arrays/expected/ast.txt +44 -0
- data/golden/tuples_and_arrays/expected/input_plan.txt +7 -0
- data/golden/tuples_and_arrays/expected/lir_00_unoptimized.txt +41 -0
- data/golden/tuples_and_arrays/expected/lir_01_hoist_scalar_references.txt +41 -0
- data/golden/tuples_and_arrays/expected/lir_02_inlined.txt +62 -0
- data/golden/tuples_and_arrays/expected/lir_03_cse.txt +51 -0
- data/golden/tuples_and_arrays/expected/lir_04_1_loop_fusion.txt +51 -0
- data/golden/tuples_and_arrays/expected/lir_04_loop_invcm.txt +51 -0
- data/golden/tuples_and_arrays/expected/lir_06_const_prop.txt +51 -0
- data/golden/tuples_and_arrays/expected/nast.txt +28 -0
- data/golden/tuples_and_arrays/expected/schema_javascript.mjs +58 -0
- data/golden/tuples_and_arrays/expected/schema_ruby.rb +88 -0
- data/golden/tuples_and_arrays/expected/snast.txt +28 -0
- data/golden/tuples_and_arrays/expected.json +18 -0
- data/golden/tuples_and_arrays/input.json +7 -0
- data/golden/tuples_and_arrays/schema.kumi +38 -0
- data/golden/with_constants/expected/ast.txt +28 -0
- data/golden/with_constants/expected/input_plan.txt +2 -0
- data/golden/with_constants/expected/lir_00_unoptimized.txt +17 -0
- data/golden/with_constants/expected/lir_01_hoist_scalar_references.txt +17 -0
- data/golden/with_constants/expected/lir_02_inlined.txt +17 -0
- data/golden/with_constants/expected/lir_03_cse.txt +17 -0
- data/golden/with_constants/expected/lir_04_1_loop_fusion.txt +17 -0
- data/golden/with_constants/expected/lir_04_loop_invcm.txt +17 -0
- data/golden/with_constants/expected/lir_06_const_prop.txt +17 -0
- data/golden/with_constants/expected/nast.txt +21 -0
- data/golden/with_constants/expected/schema_javascript.mjs +18 -0
- data/golden/with_constants/expected/schema_ruby.rb +44 -0
- data/golden/with_constants/expected/snast.txt +15 -0
- data/golden/with_constants/schema.kumi +10 -0
- data/lib/kumi/analyzer.rb +76 -24
- data/lib/kumi/configuration.rb +60 -0
- data/lib/kumi/core/analyzer/binder.rb +121 -0
- data/lib/kumi/core/analyzer/checkpoint.rb +15 -9
- data/lib/kumi/core/analyzer/constant_evaluator.rb +32 -37
- data/lib/kumi/core/analyzer/constant_folding_helpers.rb +55 -0
- data/lib/kumi/core/analyzer/debug.rb +14 -16
- data/lib/kumi/core/analyzer/fn_aliases.rb +46 -0
- data/lib/kumi/core/analyzer/folder.rb +94 -0
- data/lib/kumi/core/analyzer/macro_expander.rb +69 -0
- data/lib/kumi/core/analyzer/passes/assemble_irv2_pass.rb +130 -0
- data/lib/kumi/core/analyzer/passes/attach_anchors_pass.rb +71 -0
- data/lib/kumi/core/analyzer/passes/attach_terminal_info_pass.rb +181 -0
- data/lib/kumi/core/analyzer/passes/codegen/js/declaration_emitter.rb +317 -0
- data/lib/kumi/core/analyzer/passes/codegen/js/emitter.rb +75 -0
- data/lib/kumi/core/analyzer/passes/codegen/js/output_buffer.rb +103 -0
- data/lib/kumi/core/analyzer/passes/codegen/js_pass.rb +27 -0
- data/lib/kumi/core/analyzer/passes/codegen/ruby/declaration_emitter.rb +321 -0
- data/lib/kumi/core/analyzer/passes/codegen/ruby/emitter.rb +85 -0
- data/lib/kumi/core/analyzer/passes/codegen/ruby/output_buffer.rb +111 -0
- data/lib/kumi/core/analyzer/passes/codegen/ruby_pass.rb +32 -0
- data/lib/kumi/core/analyzer/passes/constant_folding_pass.rb +33 -0
- data/lib/kumi/core/analyzer/passes/contract_checker_pass.rb +220 -0
- data/lib/kumi/core/analyzer/passes/dependency_resolver.rb +5 -6
- data/lib/kumi/core/analyzer/passes/input_access_planner_pass.rb +7 -3
- data/lib/kumi/core/analyzer/passes/input_collector.rb +74 -122
- data/lib/kumi/core/analyzer/passes/input_form_schema_pass.rb +43 -0
- data/lib/kumi/core/analyzer/passes/ir_dependency_pass.rb +1 -1
- data/lib/kumi/core/analyzer/passes/ir_execution_schedule_pass.rb +1 -1
- data/lib/kumi/core/analyzer/passes/join_reduce_planning_pass.rb +21 -23
- data/lib/kumi/core/analyzer/passes/lir/constant_propagation_pass.rb +84 -0
- data/lib/kumi/core/analyzer/passes/lir/dead_code_elimination_pass.rb +93 -0
- data/lib/kumi/core/analyzer/passes/lir/hoist_scalar_references_pass.rb +115 -0
- data/lib/kumi/core/analyzer/passes/lir/inline_declarations_pass.rb +274 -0
- data/lib/kumi/core/analyzer/passes/lir/instruction_scheduling_pass.rb +198 -0
- data/lib/kumi/core/analyzer/passes/lir/kernel_binding_pass.rb +30 -0
- data/lib/kumi/core/analyzer/passes/lir/local_cse_pass.rb +121 -0
- data/lib/kumi/core/analyzer/passes/lir/loop_fusion_pass.rb +156 -0
- data/lib/kumi/core/analyzer/passes/lir/loop_invariant_code_motion_pass.rb +148 -0
- data/lib/kumi/core/analyzer/passes/lir/lower_pass.rb +407 -0
- data/lib/kumi/core/analyzer/passes/lir/stencil_emitter.rb +243 -0
- data/lib/kumi/core/analyzer/passes/lir/validation_pass.rb +83 -0
- data/lib/kumi/core/analyzer/passes/load_input_cse.rb +17 -16
- data/lib/kumi/core/analyzer/passes/lower_to_ir_pass.rb +4 -2
- data/lib/kumi/core/analyzer/passes/lower_to_irv2_pass.rb +197 -0
- data/lib/kumi/core/analyzer/passes/name_indexer.rb +4 -1
- data/lib/kumi/core/analyzer/passes/nast_dimensional_analyzer_pass.rb +237 -0
- data/lib/kumi/core/analyzer/passes/normalize_to_nast_pass.rb +156 -0
- data/lib/kumi/core/analyzer/passes/output_schema_pass.rb +38 -0
- data/lib/kumi/core/analyzer/passes/pass_base.rb +30 -4
- data/lib/kumi/core/analyzer/passes/precompute_access_paths_pass.rb +93 -0
- data/lib/kumi/core/analyzer/passes/scope_resolution_pass.rb +33 -30
- data/lib/kumi/core/analyzer/passes/semantic_constraint_validator.rb +5 -26
- data/lib/kumi/core/analyzer/passes/snast_pass.rb +229 -0
- data/lib/kumi/core/analyzer/passes/toposorter.rb +1 -0
- data/lib/kumi/core/analyzer/passes/type_checker.rb +13 -0
- data/lib/kumi/core/analyzer/passes/type_inferencer_pass.rb +14 -16
- data/lib/kumi/core/analyzer/passes/unsat_detector.rb +2 -1
- data/lib/kumi/core/analyzer/plans.rb +12 -0
- data/lib/kumi/core/analyzer/state_serde.rb +4 -4
- data/lib/kumi/core/analyzer/structs/access_plan.rb +2 -2
- data/lib/kumi/core/analyzer/unsat_constant_evaluator.rb +59 -0
- data/lib/kumi/core/compiler/access_codegen.rb +1 -1
- data/lib/kumi/core/compiler/access_emit/base.rb +9 -5
- data/lib/kumi/core/compiler/access_emit/each_indexed.rb +10 -3
- data/lib/kumi/core/compiler/access_emit/materialize.rb +12 -5
- data/lib/kumi/core/compiler/access_emit/ravel.rb +10 -3
- data/lib/kumi/core/compiler/access_emit/read.rb +4 -1
- data/lib/kumi/core/compiler/access_planner.rb +42 -4
- data/lib/kumi/core/compiler/access_planner_v2.rb +164 -0
- data/lib/kumi/core/explain.rb +18 -11
- data/lib/kumi/core/functions/loader.rb +47 -0
- data/lib/kumi/core/functions/model.rb +10 -0
- data/lib/kumi/core/functions/type_rules.rb +108 -0
- data/lib/kumi/core/ir/execution_engine/interpreter.rb +1 -1
- data/lib/kumi/core/ir/execution_engine/profiler.rb +107 -97
- data/lib/kumi/core/ir.rb +6 -2
- data/lib/kumi/core/irv2/builder.rb +48 -0
- data/lib/kumi/core/irv2/declaration.rb +28 -0
- data/lib/kumi/core/irv2/module.rb +108 -0
- data/lib/kumi/core/irv2/value.rb +28 -0
- data/lib/kumi/core/lir/analyze.rb +64 -0
- data/lib/kumi/core/lir/build.rb +363 -0
- data/lib/kumi/core/lir/emit.rb +62 -0
- data/lib/kumi/core/lir/structs/instruction.rb +44 -0
- data/lib/kumi/core/lir/structs/literal.rb +14 -0
- data/lib/kumi/core/lir/structs/stamp.rb +13 -0
- data/lib/kumi/core/lir/support/error.rb +9 -0
- data/lib/kumi/core/lir/support/ids.rb +34 -0
- data/lib/kumi/core/lir/validate.rb +74 -0
- data/lib/kumi/core/lir.rb +34 -0
- data/lib/kumi/core/nast.rb +216 -0
- data/lib/kumi/core/ruby_parser/dsl.rb +2 -2
- data/lib/kumi/core/ruby_parser/dsl_cascade_builder.rb +1 -1
- data/lib/kumi/core/ruby_parser/expression_converter.rb +10 -0
- data/lib/kumi/core/ruby_parser/input_builder.rb +16 -17
- data/lib/kumi/core/ruby_parser/schema_builder.rb +36 -10
- data/lib/kumi/core/ruby_parser/sugar.rb +64 -0
- data/lib/kumi/core/types/builder.rb +2 -2
- data/lib/kumi/core/types/normalizer.rb +2 -0
- data/lib/kumi/core/types/validator.rb +10 -3
- data/lib/kumi/core/types.rb +7 -0
- data/lib/kumi/dev/codegen.rb +194 -0
- data/lib/kumi/dev/golden/generator.rb +105 -0
- data/lib/kumi/dev/golden/reporter.rb +160 -0
- data/lib/kumi/dev/golden/representation.rb +45 -0
- data/lib/kumi/dev/golden/result.rb +98 -0
- data/lib/kumi/dev/golden/runtime_test.rb +93 -0
- data/lib/kumi/dev/golden/suite.rb +131 -0
- data/lib/kumi/dev/golden/verifier.rb +76 -0
- data/lib/kumi/dev/golden.rb +75 -0
- data/lib/kumi/dev/ir.rb +4 -4
- data/lib/kumi/dev/parse.rb +1 -1
- data/lib/kumi/dev/pretty_printer.rb +229 -0
- data/lib/kumi/dev/printer/irv2_formatter.rb +163 -0
- data/lib/kumi/dev/printer/width_aware_json.rb +44 -0
- data/lib/kumi/dev/profile_aggregator.rb +36 -38
- data/lib/kumi/dev/profile_runner.rb +19 -23
- data/lib/kumi/dev/runner.rb +12 -22
- data/lib/kumi/dev/support/kumi_runner.mjs +39 -0
- data/lib/kumi/dev.rb +3 -3
- data/lib/kumi/frontends/ruby.rb +12 -12
- data/lib/kumi/frontends/text.rb +26 -21
- data/lib/kumi/frontends.rb +6 -8
- data/lib/kumi/kernel_registry.rb +59 -0
- data/lib/kumi/pack/builder.rb +229 -0
- data/lib/kumi/pack.rb +15 -0
- data/lib/kumi/registry_v2/loader.rb +81 -0
- data/lib/kumi/registry_v2.rb +118 -0
- data/lib/kumi/schema.rb +83 -43
- data/lib/kumi/support/diff.rb +3 -2
- data/lib/kumi/support/ir_render.rb +1 -1
- data/lib/kumi/support/lir_printer.rb +143 -0
- data/lib/kumi/support/nast_printer.rb +93 -0
- data/lib/kumi/support/s_expression_printer.rb +5 -4
- data/lib/kumi/support/snast_printer.rb +111 -0
- data/lib/kumi/syntax/call_expression.rb +1 -1
- data/lib/kumi/syntax/input_declaration.rb +2 -2
- data/lib/kumi/syntax/node.rb +4 -12
- data/lib/kumi/syntax/root.rb +10 -0
- data/lib/kumi/syntax/trait_declaration.rb +1 -0
- data/lib/kumi/syntax/value_declaration.rb +1 -0
- data/lib/kumi/version.rb +1 -1
- data/lib/kumi.rb +46 -4
- metadata +571 -54
- data/docs/AST.md +0 -133
- data/docs/DSL.md +0 -154
- data/docs/FUNCTIONS.md +0 -176
- data/docs/VECTOR_SEMANTICS.md +0 -286
- data/docs/compiler_design_principles.md +0 -86
- data/docs/dev/analyzer-debug.md +0 -52
- data/docs/dev/parse-command.md +0 -64
- data/docs/dev/vm-profiling.md +0 -95
- data/docs/development/README.md +0 -120
- data/docs/development/error-reporting.md +0 -361
- data/docs/features/README.md +0 -58
- data/docs/features/analysis-type-inference.md +0 -42
- data/docs/features/analysis-unsat-detection.md +0 -71
- data/docs/features/hierarchical-broadcasting.md +0 -415
- data/docs/features/input-declaration-system.md +0 -58
- data/docs/features/performance.md +0 -14
- data/docs/features/s-expression-printer.md +0 -77
- data/docs/schema_metadata/broadcasts.md +0 -53
- data/docs/schema_metadata/cascades.md +0 -45
- data/docs/schema_metadata/declarations.md +0 -54
- data/docs/schema_metadata/dependencies.md +0 -57
- data/docs/schema_metadata/evaluation_order.md +0 -29
- data/docs/schema_metadata/examples.md +0 -95
- data/docs/schema_metadata/inferred_types.md +0 -46
- data/docs/schema_metadata/inputs.md +0 -86
- data/docs/schema_metadata.md +0 -108
- data/golden/mixed_nesting/schema.kumi +0 -42
- data/lib/kumi/core/function_registry/collection_functions.rb +0 -298
- data/lib/kumi/core/function_registry/comparison_functions.rb +0 -33
- data/lib/kumi/core/function_registry/conditional_functions.rb +0 -48
- data/lib/kumi/core/function_registry/function_builder.rb +0 -184
- data/lib/kumi/core/function_registry/logical_functions.rb +0 -214
- data/lib/kumi/core/function_registry/math_functions.rb +0 -74
- data/lib/kumi/core/function_registry/stat_functions.rb +0 -156
- data/lib/kumi/core/function_registry/string_functions.rb +0 -57
- data/lib/kumi/core/function_registry/type_functions.rb +0 -53
- data/lib/kumi/core/function_registry.rb +0 -176
- data/lib/kumi/registry.rb +0 -32
- data/lib/kumi/runtime/executable.rb +0 -135
- data/lib/kumi/runtime/run.rb +0 -105
- data/performance_results.txt +0 -63
- data/scripts/analyze_broadcast_methods.rb +0 -68
- data/scripts/analyze_cascade_methods.rb +0 -74
- data/scripts/check_broadcasting_coverage.rb +0 -51
- data/scripts/find_dead_code.rb +0 -114
- data/scripts/generate_function_docs.rb +0 -71
- data/scripts/test_mixed_nesting_performance.rb +0 -206
@@ -1,298 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kumi
|
4
|
-
module Core
|
5
|
-
module FunctionRegistry
|
6
|
-
# Collection manipulation and query functions
|
7
|
-
module CollectionFunctions
|
8
|
-
def self.definitions
|
9
|
-
{
|
10
|
-
# Collection queries (these are reducers - they reduce arrays to scalars)
|
11
|
-
empty?: FunctionBuilder.collection_unary(:empty?, "Check if collection is empty", :empty?, reducer: true,
|
12
|
-
structure_function: true),
|
13
|
-
size: FunctionBuilder::Entry.new(
|
14
|
-
fn: lambda { |collection|
|
15
|
-
collection.size
|
16
|
-
},
|
17
|
-
arity: 1,
|
18
|
-
param_types: [:any],
|
19
|
-
return_type: :integer,
|
20
|
-
description: "Get size of collection",
|
21
|
-
param_modes: { fixed: [:elem] }, # take a vector argument elementwise
|
22
|
-
reducer: true,
|
23
|
-
structure_function: true
|
24
|
-
),
|
25
|
-
|
26
|
-
# Element access
|
27
|
-
first: FunctionBuilder::Entry.new(
|
28
|
-
fn: lambda(&:first),
|
29
|
-
arity: 1,
|
30
|
-
param_types: [Kumi::Core::Types.array(:any)],
|
31
|
-
return_type: :any,
|
32
|
-
description: "Get first element of collection",
|
33
|
-
reducer: true
|
34
|
-
),
|
35
|
-
|
36
|
-
last: FunctionBuilder::Entry.new(
|
37
|
-
fn: lambda(&:last),
|
38
|
-
arity: 1,
|
39
|
-
param_types: [Kumi::Core::Types.array(:any)],
|
40
|
-
return_type: :any,
|
41
|
-
description: "Get last element of collection",
|
42
|
-
reducer: true
|
43
|
-
),
|
44
|
-
|
45
|
-
# Mathematical operations on collections
|
46
|
-
sum: FunctionBuilder::Entry.new(
|
47
|
-
fn: lambda(&:sum),
|
48
|
-
arity: 1,
|
49
|
-
param_types: [Kumi::Core::Types.array(:float)],
|
50
|
-
return_type: :float,
|
51
|
-
description: "Sum all numeric elements in collection",
|
52
|
-
reducer: true
|
53
|
-
),
|
54
|
-
|
55
|
-
min: FunctionBuilder::Entry.new(
|
56
|
-
fn: lambda(&:min),
|
57
|
-
arity: 1,
|
58
|
-
param_types: [Kumi::Core::Types.array(:float)],
|
59
|
-
return_type: :float,
|
60
|
-
description: "Find minimum value in numeric collection",
|
61
|
-
reducer: true
|
62
|
-
),
|
63
|
-
|
64
|
-
max: FunctionBuilder::Entry.new(
|
65
|
-
fn: lambda(&:max),
|
66
|
-
arity: 1,
|
67
|
-
param_types: [Kumi::Core::Types.array(:float)],
|
68
|
-
return_type: :float,
|
69
|
-
description: "Find maximum value in numeric collection",
|
70
|
-
reducer: true,
|
71
|
-
param_modes: { fixed: [:elem] } # first param is the vector being reduced
|
72
|
-
),
|
73
|
-
|
74
|
-
# Collection operations
|
75
|
-
include?: FunctionBuilder::Entry.new(
|
76
|
-
fn: ->(collection, element) { collection.include?(element) },
|
77
|
-
arity: 2,
|
78
|
-
param_types: [Kumi::Core::Types.array(:any), :any],
|
79
|
-
return_type: :boolean,
|
80
|
-
description: "Check if collection includes element"
|
81
|
-
),
|
82
|
-
|
83
|
-
reverse: FunctionBuilder::Entry.new(
|
84
|
-
fn: lambda(&:reverse),
|
85
|
-
arity: 1,
|
86
|
-
param_types: [Kumi::Core::Types.array(:any)],
|
87
|
-
return_type: Kumi::Core::Types.array(:any),
|
88
|
-
description: "Reverse collection order"
|
89
|
-
),
|
90
|
-
|
91
|
-
sort: FunctionBuilder::Entry.new(
|
92
|
-
fn: lambda(&:sort),
|
93
|
-
arity: 1,
|
94
|
-
param_types: [Kumi::Core::Types.array(:any)],
|
95
|
-
return_type: Kumi::Core::Types.array(:any),
|
96
|
-
description: "Sort collection"
|
97
|
-
),
|
98
|
-
|
99
|
-
unique: FunctionBuilder::Entry.new(
|
100
|
-
fn: lambda(&:uniq),
|
101
|
-
arity: 1,
|
102
|
-
param_types: [Kumi::Core::Types.array(:any)],
|
103
|
-
return_type: Kumi::Core::Types.array(:any),
|
104
|
-
description: "Remove duplicate elements from collection"
|
105
|
-
),
|
106
|
-
|
107
|
-
# Array transformation functions
|
108
|
-
flatten: FunctionBuilder::Entry.new(
|
109
|
-
fn: ->(array) { array.flatten },
|
110
|
-
arity: 1,
|
111
|
-
param_types: [Kumi::Core::Types.array(:any)],
|
112
|
-
return_type: Kumi::Core::Types.array(:any),
|
113
|
-
description: "Flatten nested arrays into a single array",
|
114
|
-
structure_function: true,
|
115
|
-
reducer: true
|
116
|
-
),
|
117
|
-
|
118
|
-
flatten_one: FunctionBuilder::Entry.new(
|
119
|
-
fn: ->(array) { array.flatten(1) },
|
120
|
-
arity: 1,
|
121
|
-
param_types: [Kumi::Core::Types.array(:any)],
|
122
|
-
return_type: Kumi::Core::Types.array(:any),
|
123
|
-
description: "Flatten nested arrays by one level only",
|
124
|
-
structure_function: true
|
125
|
-
),
|
126
|
-
|
127
|
-
to_array: FunctionBuilder::Entry.new(
|
128
|
-
fn: ->(vals) { vals },
|
129
|
-
arity: 1,
|
130
|
-
param_types: [Kumi::Core::Types.array(:any)],
|
131
|
-
return_type: Kumi::Core::Types.array(:any),
|
132
|
-
description: "Collect vector rows into a Ruby array",
|
133
|
-
reducer: true
|
134
|
-
),
|
135
|
-
|
136
|
-
# Mathematical transformation functions
|
137
|
-
map_multiply: FunctionBuilder::Entry.new(
|
138
|
-
fn: ->(collection, factor) { collection.map { |x| x * factor } },
|
139
|
-
arity: 2,
|
140
|
-
param_types: [Kumi::Core::Types.array(:float), :float],
|
141
|
-
return_type: Kumi::Core::Types.array(:float),
|
142
|
-
description: "Multiply each element by factor"
|
143
|
-
),
|
144
|
-
|
145
|
-
map_add: FunctionBuilder::Entry.new(
|
146
|
-
fn: ->(collection, value) { collection.map { |x| x + value } },
|
147
|
-
arity: 2,
|
148
|
-
param_types: [Kumi::Core::Types.array(:float), :float],
|
149
|
-
return_type: Kumi::Core::Types.array(:float),
|
150
|
-
description: "Add value to each element"
|
151
|
-
),
|
152
|
-
|
153
|
-
# Conditional transformation functions
|
154
|
-
map_conditional: FunctionBuilder::Entry.new(
|
155
|
-
fn: lambda { |collection, condition_value, true_value, false_value|
|
156
|
-
collection.map { |x| x == condition_value ? true_value : false_value }
|
157
|
-
},
|
158
|
-
arity: 4,
|
159
|
-
param_types: %i[array any any any],
|
160
|
-
return_type: :array,
|
161
|
-
description: "Transform elements based on condition: if element == condition_value then true_value else false_value"
|
162
|
-
),
|
163
|
-
|
164
|
-
# Range/index functions for grid operations
|
165
|
-
build_array: FunctionBuilder::Entry.new(
|
166
|
-
fn: lambda { |size, &generator|
|
167
|
-
(0...size).map { |i| generator ? generator.call(i) : i }
|
168
|
-
},
|
169
|
-
arity: 1,
|
170
|
-
param_types: [:integer],
|
171
|
-
return_type: Kumi::Core::Types.array(:any),
|
172
|
-
description: "Build array of given size with index values"
|
173
|
-
),
|
174
|
-
|
175
|
-
range: FunctionBuilder::Entry.new(
|
176
|
-
fn: ->(start, finish) { (start...finish).to_a },
|
177
|
-
arity: 2,
|
178
|
-
param_types: %i[integer integer],
|
179
|
-
return_type: Kumi::Core::Types.array(:integer),
|
180
|
-
description: "Generate range of integers from start to finish (exclusive)"
|
181
|
-
),
|
182
|
-
|
183
|
-
# Array slicing and grouping for rendering
|
184
|
-
each_slice: FunctionBuilder::Entry.new(
|
185
|
-
fn: ->(array, size) { array.each_slice(size).to_a },
|
186
|
-
arity: 2,
|
187
|
-
param_types: %i[array integer],
|
188
|
-
return_type: Kumi::Core::Types.array(:array),
|
189
|
-
description: "Group array elements into subarrays of given size"
|
190
|
-
),
|
191
|
-
|
192
|
-
join: FunctionBuilder::Entry.new(
|
193
|
-
fn: lambda { |array, separator = ""|
|
194
|
-
array.map(&:to_s).join(separator.to_s)
|
195
|
-
},
|
196
|
-
arity: 2,
|
197
|
-
param_types: %i[array string],
|
198
|
-
return_type: :string,
|
199
|
-
description: "Join array elements into string with separator"
|
200
|
-
),
|
201
|
-
|
202
|
-
# Transform each subarray to string and join the results
|
203
|
-
map_join_rows: FunctionBuilder::Entry.new(
|
204
|
-
fn: lambda { |array_of_arrays, row_separator = "", column_separator = "\n"|
|
205
|
-
array_of_arrays.map { |row| row.join(row_separator.to_s) }.join(column_separator.to_s)
|
206
|
-
},
|
207
|
-
arity: 3,
|
208
|
-
param_types: [Kumi::Core::Types.array(:array), :string, :string],
|
209
|
-
return_type: :string,
|
210
|
-
description: "Join 2D array into string with row and column separators"
|
211
|
-
),
|
212
|
-
|
213
|
-
# Higher-order collection functions (limited to common patterns)
|
214
|
-
map_with_index: FunctionBuilder::Entry.new(
|
215
|
-
fn: ->(collection) { collection.map.with_index.to_a },
|
216
|
-
arity: 1,
|
217
|
-
param_types: [Kumi::Core::Types.array(:any)],
|
218
|
-
return_type: Kumi::Core::Types.array(:any),
|
219
|
-
description: "Map collection elements to [element, index] pairs"
|
220
|
-
),
|
221
|
-
|
222
|
-
indices: FunctionBuilder::Entry.new(
|
223
|
-
fn: ->(collection) { (0...collection.size).to_a },
|
224
|
-
arity: 1,
|
225
|
-
param_types: [Kumi::Core::Types.array(:any)],
|
226
|
-
return_type: Kumi::Core::Types.array(:integer),
|
227
|
-
description: "Generate array of indices for the collection"
|
228
|
-
),
|
229
|
-
|
230
|
-
# Conditional aggregation functions
|
231
|
-
count_if: FunctionBuilder::Entry.new(
|
232
|
-
fn: ->(condition_array) { condition_array.count(true) },
|
233
|
-
arity: 1,
|
234
|
-
param_types: [Kumi::Core::Types.array(:boolean)],
|
235
|
-
return_type: :integer,
|
236
|
-
description: "Count number of true values in boolean array",
|
237
|
-
reducer: true
|
238
|
-
),
|
239
|
-
|
240
|
-
sum_if: FunctionBuilder::Entry.new(
|
241
|
-
fn: lambda { |value_array, condition_array|
|
242
|
-
value_array.zip(condition_array).sum { |value, condition| condition ? value : 0 }
|
243
|
-
},
|
244
|
-
arity: 2,
|
245
|
-
param_types: [Kumi::Core::Types.array(:float), Kumi::Core::Types.array(:boolean)],
|
246
|
-
return_type: :float,
|
247
|
-
description: "Sum values where corresponding condition is true",
|
248
|
-
reducer: true
|
249
|
-
),
|
250
|
-
|
251
|
-
avg_if: FunctionBuilder::Entry.new(
|
252
|
-
fn: lambda { |value_array, condition_array|
|
253
|
-
pairs = value_array.zip(condition_array)
|
254
|
-
true_values = pairs.filter_map { |value, condition| value if condition }
|
255
|
-
return 0.0 if true_values.empty?
|
256
|
-
|
257
|
-
true_values.sum.to_f / true_values.size
|
258
|
-
},
|
259
|
-
arity: 2,
|
260
|
-
param_types: [Kumi::Core::Types.array(:float), Kumi::Core::Types.array(:boolean)],
|
261
|
-
return_type: :float,
|
262
|
-
description: "Average values where corresponding condition is true",
|
263
|
-
reducer: true
|
264
|
-
),
|
265
|
-
|
266
|
-
# Flattening utilities for hierarchical data
|
267
|
-
any_across: FunctionBuilder::Entry.new(
|
268
|
-
fn: ->(nested_array) { nested_array.flatten.any? },
|
269
|
-
arity: 1,
|
270
|
-
param_types: [Kumi::Core::Types.array(:any)],
|
271
|
-
return_type: :boolean,
|
272
|
-
description: "Check if any element is truthy across all nested levels",
|
273
|
-
reducer: true
|
274
|
-
),
|
275
|
-
|
276
|
-
all_across: FunctionBuilder::Entry.new(
|
277
|
-
fn: ->(nested_array) { nested_array.flatten.all? },
|
278
|
-
arity: 1,
|
279
|
-
param_types: [Kumi::Core::Types.array(:any)],
|
280
|
-
return_type: :boolean,
|
281
|
-
description: "Check if all elements are truthy across all nested levels",
|
282
|
-
reducer: true
|
283
|
-
),
|
284
|
-
|
285
|
-
count_across: FunctionBuilder::Entry.new(
|
286
|
-
fn: ->(nested_array) { nested_array.flatten.size },
|
287
|
-
arity: 1,
|
288
|
-
param_types: [Kumi::Core::Types.array(:any)],
|
289
|
-
return_type: :integer,
|
290
|
-
description: "Count total elements across all nested levels",
|
291
|
-
reducer: true
|
292
|
-
)
|
293
|
-
}
|
294
|
-
end
|
295
|
-
end
|
296
|
-
end
|
297
|
-
end
|
298
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kumi
|
4
|
-
module Core
|
5
|
-
module FunctionRegistry
|
6
|
-
# Comparison and equality functions
|
7
|
-
module ComparisonFunctions
|
8
|
-
def self.definitions
|
9
|
-
{
|
10
|
-
# Equality operators
|
11
|
-
:== => FunctionBuilder.equality(:==, "Equality comparison", :==),
|
12
|
-
:!= => FunctionBuilder.equality(:!=, "Inequality comparison", :!=),
|
13
|
-
|
14
|
-
# Comparison operators
|
15
|
-
:> => FunctionBuilder.comparison(:>, "Greater than comparison", :>),
|
16
|
-
:< => FunctionBuilder.comparison(:<, "Less than comparison", :<),
|
17
|
-
:>= => FunctionBuilder.comparison(:>=, "Greater than or equal comparison", :>=),
|
18
|
-
:<= => FunctionBuilder.comparison(:<=, "Less than or equal comparison", :<=),
|
19
|
-
|
20
|
-
# Range comparison
|
21
|
-
:between? => FunctionBuilder::Entry.new(
|
22
|
-
fn: ->(value, min, max) { value.between?(min, max) },
|
23
|
-
arity: 3,
|
24
|
-
param_types: %i[float float float],
|
25
|
-
return_type: :boolean,
|
26
|
-
description: "Check if value is between min and max"
|
27
|
-
)
|
28
|
-
}
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kumi
|
4
|
-
module Core
|
5
|
-
module FunctionRegistry
|
6
|
-
module ConditionalFunctions
|
7
|
-
def self.definitions
|
8
|
-
{
|
9
|
-
# a ? b : c
|
10
|
-
conditional: FunctionBuilder::Entry.new(
|
11
|
-
fn: ->(condition, true_value, false_value) { condition ? true_value : false_value },
|
12
|
-
arity: 3,
|
13
|
-
param_types: %i[boolean any any],
|
14
|
-
return_type: :any,
|
15
|
-
# all three are element-wise (scalars auto-broadcast)
|
16
|
-
param_modes: { fixed: %i[elem elem elem] },
|
17
|
-
description: "Ternary conditional operator"
|
18
|
-
),
|
19
|
-
|
20
|
-
# if(cond, then, else=nil)
|
21
|
-
if: FunctionBuilder::Entry.new(
|
22
|
-
fn: ->(condition, true_value, false_value = nil) { condition ? true_value : false_value },
|
23
|
-
# keep arity=3; the last arg is optional at call time
|
24
|
-
arity: 3,
|
25
|
-
param_types: %i[boolean any any],
|
26
|
-
return_type: :any,
|
27
|
-
param_modes: { fixed: %i[elem elem elem] },
|
28
|
-
description: "If-then-else conditional",
|
29
|
-
reducer: false,
|
30
|
-
structure_function: false
|
31
|
-
),
|
32
|
-
|
33
|
-
# coalesce(a, b, c, ...)
|
34
|
-
coalesce: FunctionBuilder::Entry.new(
|
35
|
-
fn: ->(*values) { values.find { |v| !v.nil? } },
|
36
|
-
arity: -1, # variadic
|
37
|
-
param_types: [:any],
|
38
|
-
return_type: :any,
|
39
|
-
# every variadic arg participates element-wise
|
40
|
-
param_modes: { fixed: [], variadic: :elem },
|
41
|
-
description: "Return first non-nil value"
|
42
|
-
)
|
43
|
-
}
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,184 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kumi
|
4
|
-
module Core
|
5
|
-
module FunctionRegistry
|
6
|
-
class FunctionBuilder
|
7
|
-
# Rich, defaulted function entry
|
8
|
-
class Entry
|
9
|
-
# NOTE: Keep ctor args minimal; everything else has sensible defaults.
|
10
|
-
attr_reader :fn, :arity, :param_types, :return_type, :description,
|
11
|
-
:reducer, :structure_function, :param_modes, :param_info
|
12
|
-
|
13
|
-
# param_modes: nil | ->(argc){[:elem,:scalar,...]} | {fixed: [...], variadic: :elem|:scalar}
|
14
|
-
# param_info: nil | ->(argc){[specs]} | {fixed: [...], variadic: {…}}
|
15
|
-
# where a spec is: { name:, type:, mode:, required:, default:, doc: }
|
16
|
-
def initialize(
|
17
|
-
fn:,
|
18
|
-
arity: nil, # Integer (>=0) or -1 / nil for variadic
|
19
|
-
param_types: nil, # defaults to [:any] * arity (when fixed)
|
20
|
-
return_type: :any,
|
21
|
-
description: "",
|
22
|
-
reducer: false,
|
23
|
-
structure_function: false,
|
24
|
-
param_modes: nil,
|
25
|
-
param_info: nil
|
26
|
-
)
|
27
|
-
@fn = fn
|
28
|
-
@arity = arity
|
29
|
-
@param_types = param_types || default_param_types(arity)
|
30
|
-
@return_type = return_type
|
31
|
-
@description = description
|
32
|
-
@reducer = !!reducer
|
33
|
-
@structure_function = !!structure_function
|
34
|
-
@param_modes = normalize_param_modes(param_modes, arity)
|
35
|
-
@param_info = normalize_param_info(param_info, arity, @param_types)
|
36
|
-
end
|
37
|
-
|
38
|
-
# Concrete modes for a call site
|
39
|
-
def param_modes_for(argc)
|
40
|
-
pm = @param_modes
|
41
|
-
return pm.call(argc) if pm.respond_to?(:call)
|
42
|
-
|
43
|
-
fixed = Array(pm[:fixed] || [])
|
44
|
-
return fixed.first(argc) if argc <= fixed.size
|
45
|
-
|
46
|
-
fixed + Array.new(argc - fixed.size, pm.fetch(:variadic, :elem))
|
47
|
-
end
|
48
|
-
|
49
|
-
# Concrete param specs for a call site
|
50
|
-
# → [{name:, type:, mode:, required:, default:, doc:}, ...]
|
51
|
-
def param_specs_for(argc)
|
52
|
-
base = if @param_info.respond_to?(:call)
|
53
|
-
@param_info.call(argc)
|
54
|
-
else
|
55
|
-
fixed = Array(@param_info[:fixed] || [])
|
56
|
-
if argc <= fixed.size
|
57
|
-
fixed.first(argc)
|
58
|
-
else
|
59
|
-
fixed + Array.new(argc - fixed.size, @param_info.fetch(:variadic, {}))
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
modes = param_modes_for(argc)
|
64
|
-
types = expand_types_for(argc)
|
65
|
-
|
66
|
-
base.each_with_index.map do |spec, i|
|
67
|
-
{
|
68
|
-
name: spec[:name] || auto_name(i),
|
69
|
-
type: spec[:type] || types[i] || :any,
|
70
|
-
mode: spec[:mode] || modes[i] || :elem,
|
71
|
-
required: spec.key?(:required) ? spec[:required] : true,
|
72
|
-
default: spec[:default],
|
73
|
-
doc: spec[:doc] || ""
|
74
|
-
}
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
private
|
79
|
-
|
80
|
-
def default_param_types(arity)
|
81
|
-
if arity.is_a?(Integer) && arity >= 0
|
82
|
-
Array.new(arity, :any)
|
83
|
-
else
|
84
|
-
[] # variadic → types resolved per call
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def expand_types_for(argc)
|
89
|
-
if @param_types.nil? || @param_types.empty?
|
90
|
-
Array.new(argc, :any)
|
91
|
-
elsif @param_types.length >= argc
|
92
|
-
@param_types.first(argc)
|
93
|
-
else
|
94
|
-
@param_types + Array.new(argc - @param_types.length, @param_types.last || :any)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def normalize_param_modes(pm, arity)
|
99
|
-
return pm if pm
|
100
|
-
|
101
|
-
# Default: everything element-wise/broadcastable
|
102
|
-
->(argc) { Array.new(argc, :elem) }
|
103
|
-
end
|
104
|
-
|
105
|
-
def normalize_param_info(info, arity, types)
|
106
|
-
return info if info
|
107
|
-
|
108
|
-
# Default: synthesize from types/modes at call time
|
109
|
-
->(argc) { Array.new(argc) { {} } }
|
110
|
-
end
|
111
|
-
|
112
|
-
def auto_name(i) = :"arg#{i + 1}"
|
113
|
-
end
|
114
|
-
|
115
|
-
# ===== Helper constructors (unchanged usage; now benefit from defaults) =====
|
116
|
-
|
117
|
-
def self.comparison(_name, description, op)
|
118
|
-
Entry.new(
|
119
|
-
fn: ->(a, b) { a.public_send(op, b) },
|
120
|
-
arity: 2, param_types: %i[float float],
|
121
|
-
return_type: :boolean, description: description
|
122
|
-
)
|
123
|
-
end
|
124
|
-
|
125
|
-
def self.equality(_name, description, op)
|
126
|
-
Entry.new(
|
127
|
-
fn: ->(a, b) { a.public_send(op, b) },
|
128
|
-
arity: 2, param_types: %i[any any],
|
129
|
-
return_type: :boolean, description: description
|
130
|
-
)
|
131
|
-
end
|
132
|
-
|
133
|
-
def self.math_binary(_name, description, op, return_type: :float)
|
134
|
-
Entry.new(
|
135
|
-
fn: ->(a, b) { a.public_send(op, b) },
|
136
|
-
arity: 2, param_types: %i[float float],
|
137
|
-
return_type: return_type, description: description
|
138
|
-
)
|
139
|
-
end
|
140
|
-
|
141
|
-
def self.math_unary(_name, description, op, return_type: :float)
|
142
|
-
Entry.new(
|
143
|
-
fn: proc(&op),
|
144
|
-
arity: 1, param_types: [:float],
|
145
|
-
return_type: return_type, description: description
|
146
|
-
)
|
147
|
-
end
|
148
|
-
|
149
|
-
def self.string_unary(_name, description, op)
|
150
|
-
Entry.new(
|
151
|
-
fn: ->(s) { s.to_s.public_send(op) },
|
152
|
-
arity: 1, param_types: [:string],
|
153
|
-
return_type: :string, description: description
|
154
|
-
)
|
155
|
-
end
|
156
|
-
|
157
|
-
def self.string_binary(_name, description, op, return_type: :string)
|
158
|
-
Entry.new(
|
159
|
-
fn: ->(s, x) { s.to_s.public_send(op, x.to_s) },
|
160
|
-
arity: 2, param_types: %i[string string],
|
161
|
-
return_type: return_type, description: description
|
162
|
-
)
|
163
|
-
end
|
164
|
-
|
165
|
-
def self.logical_variadic(_name, description, op)
|
166
|
-
Entry.new(
|
167
|
-
fn: ->(*conds) { conds.flatten.public_send(op) },
|
168
|
-
arity: -1, param_types: [:boolean],
|
169
|
-
return_type: :boolean, description: description
|
170
|
-
)
|
171
|
-
end
|
172
|
-
|
173
|
-
def self.collection_unary(_name, description, op, return_type: :boolean, reducer: false, structure_function: false)
|
174
|
-
Entry.new(
|
175
|
-
fn: proc(&op),
|
176
|
-
arity: 1, param_types: [Kumi::Core::Types.array(:any)],
|
177
|
-
return_type: return_type, description: description,
|
178
|
-
reducer: reducer, structure_function: structure_function
|
179
|
-
)
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|