kumi 0.0.30 → 0.0.33
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/CHANGELOG.md +21 -1
- data/README.md +31 -99
- data/data/kernels/ruby/core/arithmetic.yaml +2 -2
- data/docs/COMPOSED_SCHEMAS.md +137 -0
- data/docs/SCHEMA_IMPORTS.md +275 -0
- data/docs/SYNTAX.md +48 -0
- data/golden/array_element/expected/schema_ruby.rb +2 -27
- data/golden/array_index/expected/nast.txt +6 -6
- data/golden/array_index/expected/schema_ruby.rb +4 -31
- data/golden/array_operations/expected/lir_06_const_prop.txt +4 -8
- data/golden/array_operations/expected/schema_javascript.mjs +4 -8
- data/golden/array_operations/expected/schema_ruby.rb +10 -43
- data/golden/cascade_logic/expected/lir_06_const_prop.txt +7 -14
- data/golden/cascade_logic/expected/schema_javascript.mjs +7 -14
- data/golden/cascade_logic/expected/schema_ruby.rb +11 -45
- data/golden/chained_fusion/expected/lir_06_const_prop.txt +8 -18
- data/golden/chained_fusion/expected/schema_javascript.mjs +8 -18
- data/golden/chained_fusion/expected/schema_ruby.rb +14 -53
- data/golden/decimal_explicit/expected/schema_ruby.rb +4 -31
- data/golden/element_arrays/expected/lir_06_const_prop.txt +5 -11
- data/golden/element_arrays/expected/schema_javascript.mjs +5 -11
- data/golden/element_arrays/expected/schema_ruby.rb +13 -50
- data/golden/empty_and_null_inputs/expected/schema_ruby.rb +4 -31
- data/golden/example_xpto/expected/ast.txt +23 -0
- data/golden/example_xpto/expected/input_plan.txt +1 -0
- data/golden/example_xpto/expected/lir_00_unoptimized.txt +16 -0
- data/golden/example_xpto/expected/lir_01_hoist_scalar_references.txt +16 -0
- data/golden/example_xpto/expected/lir_02_inlined.txt +16 -0
- data/golden/example_xpto/expected/lir_03_cse.txt +16 -0
- data/golden/example_xpto/expected/lir_04_1_loop_fusion.txt +16 -0
- data/golden/example_xpto/expected/lir_04_loop_invcm.txt +16 -0
- data/golden/example_xpto/expected/lir_06_const_prop.txt +13 -0
- data/golden/example_xpto/expected/nast.txt +17 -0
- data/golden/example_xpto/expected/schema_javascript.mjs +13 -0
- data/golden/example_xpto/expected/schema_ruby.rb +13 -0
- data/golden/example_xpto/expected/snast.txt +17 -0
- data/golden/example_xpto/expected.json +4 -0
- data/golden/example_xpto/input.json +3 -0
- data/golden/example_xpto/schema.kumi +8 -0
- data/golden/function_overload/expected/schema_ruby.rb +2 -27
- data/golden/game_of_life/expected/lir_06_const_prop.txt +236 -287
- data/golden/game_of_life/expected/schema_javascript.mjs +32 -39
- data/golden/game_of_life/expected/schema_ruby.rb +34 -66
- data/golden/hash_keys/expected/lir_06_const_prop.txt +4 -10
- data/golden/hash_keys/expected/schema_javascript.mjs +6 -12
- data/golden/hash_keys/expected/schema_ruby.rb +8 -39
- data/golden/hash_value/expected/lir_06_const_prop.txt +3 -6
- data/golden/hash_value/expected/schema_javascript.mjs +3 -6
- data/golden/hash_value/expected/schema_ruby.rb +7 -37
- data/golden/hierarchical_complex/expected/lir_06_const_prop.txt +9 -18
- data/golden/hierarchical_complex/expected/schema_javascript.mjs +9 -18
- data/golden/hierarchical_complex/expected/schema_ruby.rb +14 -51
- data/golden/inline_rename_scope_leak/expected/lir_06_const_prop.txt +2 -6
- data/golden/inline_rename_scope_leak/expected/schema_javascript.mjs +2 -6
- data/golden/inline_rename_scope_leak/expected/schema_ruby.rb +7 -39
- data/golden/input_reference/expected/schema_ruby.rb +6 -35
- data/golden/interleaved_fusion/expected/lir_06_const_prop.txt +6 -14
- data/golden/interleaved_fusion/expected/schema_javascript.mjs +6 -14
- data/golden/interleaved_fusion/expected/schema_ruby.rb +11 -47
- data/golden/let_inline/expected/lir_06_const_prop.txt +1 -2
- data/golden/let_inline/expected/schema_javascript.mjs +1 -2
- data/golden/let_inline/expected/schema_ruby.rb +3 -29
- data/golden/loop_fusion/expected/lir_06_const_prop.txt +4 -10
- data/golden/loop_fusion/expected/schema_javascript.mjs +4 -10
- data/golden/loop_fusion/expected/schema_ruby.rb +8 -41
- data/golden/min_reduce_scope/expected/lir_06_const_prop.txt +3 -6
- data/golden/min_reduce_scope/expected/schema_javascript.mjs +3 -6
- data/golden/min_reduce_scope/expected/schema_ruby.rb +8 -39
- data/golden/mixed_dimensions/expected/lir_06_const_prop.txt +1 -2
- data/golden/mixed_dimensions/expected/schema_javascript.mjs +1 -2
- data/golden/mixed_dimensions/expected/schema_ruby.rb +5 -33
- data/golden/multirank_hoisting/expected/lir_06_const_prop.txt +9 -18
- data/golden/multirank_hoisting/expected/schema_javascript.mjs +9 -18
- data/golden/multirank_hoisting/expected/schema_ruby.rb +16 -55
- data/golden/nested_hash/expected/lir_06_const_prop.txt +1 -2
- data/golden/nested_hash/expected/schema_javascript.mjs +1 -2
- data/golden/nested_hash/expected/schema_ruby.rb +3 -29
- data/golden/reduction_broadcast/expected/schema_ruby.rb +5 -33
- data/golden/roll/expected/lir_06_const_prop.txt +8 -15
- data/golden/roll/expected/schema_javascript.mjs +8 -15
- data/golden/roll/expected/schema_ruby.rb +13 -48
- data/golden/schema_imports_broadcasting_with_imports/expected/ast.txt +26 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/input_plan.txt +5 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_00_unoptimized.txt +20 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_01_hoist_scalar_references.txt +20 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_02_inlined.txt +22 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_03_cse.txt +21 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_04_1_loop_fusion.txt +21 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_04_loop_invcm.txt +21 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_06_const_prop.txt +21 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/nast.txt +12 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/schema_javascript.mjs +22 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/schema_ruby.rb +24 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/snast.txt +12 -0
- data/golden/schema_imports_broadcasting_with_imports/expected.json +4 -0
- data/golden/schema_imports_broadcasting_with_imports/input.json +7 -0
- data/golden/schema_imports_broadcasting_with_imports/schema.kumi +14 -0
- data/golden/schema_imports_complex_order_calc/expected/ast.txt +82 -0
- data/golden/schema_imports_complex_order_calc/expected/input_plan.txt +16 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_00_unoptimized.txt +94 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_01_hoist_scalar_references.txt +94 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_02_inlined.txt +187 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_03_cse.txt +131 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_04_1_loop_fusion.txt +131 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_04_loop_invcm.txt +131 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_06_const_prop.txt +131 -0
- data/golden/schema_imports_complex_order_calc/expected/nast.txt +56 -0
- data/golden/schema_imports_complex_order_calc/expected/schema_javascript.mjs +147 -0
- data/golden/schema_imports_complex_order_calc/expected/schema_ruby.rb +149 -0
- data/golden/schema_imports_complex_order_calc/expected/snast.txt +56 -0
- data/golden/schema_imports_complex_order_calc/expected.json +12 -0
- data/golden/schema_imports_complex_order_calc/input.json +20 -0
- data/golden/schema_imports_complex_order_calc/schema.kumi +33 -0
- data/golden/schema_imports_composed_order/expected/ast.txt +33 -0
- data/golden/schema_imports_composed_order/expected/input_plan.txt +3 -0
- data/golden/schema_imports_composed_order/expected/lir_00_unoptimized.txt +25 -0
- data/golden/schema_imports_composed_order/expected/lir_01_hoist_scalar_references.txt +25 -0
- data/golden/schema_imports_composed_order/expected/lir_02_inlined.txt +33 -0
- data/golden/schema_imports_composed_order/expected/lir_03_cse.txt +33 -0
- data/golden/schema_imports_composed_order/expected/lir_04_1_loop_fusion.txt +33 -0
- data/golden/schema_imports_composed_order/expected/lir_04_loop_invcm.txt +33 -0
- data/golden/schema_imports_composed_order/expected/lir_06_const_prop.txt +33 -0
- data/golden/schema_imports_composed_order/expected/nast.txt +25 -0
- data/golden/schema_imports_composed_order/expected/schema_javascript.mjs +35 -0
- data/golden/schema_imports_composed_order/expected/schema_ruby.rb +33 -0
- data/golden/schema_imports_composed_order/expected/snast.txt +25 -0
- data/golden/schema_imports_composed_order/expected.json +6 -0
- data/golden/schema_imports_composed_order/input.json +5 -0
- data/golden/schema_imports_composed_order/schema.kumi +15 -0
- data/golden/schema_imports_discount_with_tax/expected/ast.txt +37 -0
- data/golden/schema_imports_discount_with_tax/expected/input_plan.txt +2 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_00_unoptimized.txt +30 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_01_hoist_scalar_references.txt +30 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_02_inlined.txt +37 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_03_cse.txt +34 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_04_1_loop_fusion.txt +34 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_04_loop_invcm.txt +34 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_06_const_prop.txt +34 -0
- data/golden/schema_imports_discount_with_tax/expected/nast.txt +30 -0
- data/golden/schema_imports_discount_with_tax/expected/schema_javascript.mjs +37 -0
- data/golden/schema_imports_discount_with_tax/expected/schema_ruby.rb +34 -0
- data/golden/schema_imports_discount_with_tax/expected/snast.txt +30 -0
- data/golden/schema_imports_discount_with_tax/expected.json +7 -0
- data/golden/schema_imports_discount_with_tax/input.json +4 -0
- data/golden/schema_imports_discount_with_tax/schema.kumi +15 -0
- data/golden/schema_imports_line_items/expected/ast.txt +35 -0
- data/golden/schema_imports_line_items/expected/input_plan.txt +8 -0
- data/golden/schema_imports_line_items/expected/lir_00_unoptimized.txt +19 -0
- data/golden/schema_imports_line_items/expected/lir_01_hoist_scalar_references.txt +19 -0
- data/golden/schema_imports_line_items/expected/lir_02_inlined.txt +24 -0
- data/golden/schema_imports_line_items/expected/lir_03_cse.txt +22 -0
- data/golden/schema_imports_line_items/expected/lir_04_1_loop_fusion.txt +22 -0
- data/golden/schema_imports_line_items/expected/lir_04_loop_invcm.txt +22 -0
- data/golden/schema_imports_line_items/expected/lir_06_const_prop.txt +22 -0
- data/golden/schema_imports_line_items/expected/nast.txt +19 -0
- data/golden/schema_imports_line_items/expected/schema_javascript.mjs +23 -0
- data/golden/schema_imports_line_items/expected/schema_ruby.rb +22 -0
- data/golden/schema_imports_line_items/expected/snast.txt +19 -0
- data/golden/schema_imports_line_items/expected.json +5 -0
- data/golden/schema_imports_line_items/input.json +13 -0
- data/golden/schema_imports_line_items/schema.kumi +17 -0
- data/golden/schema_imports_multiple/expected/ast.txt +35 -0
- data/golden/schema_imports_multiple/expected/input_plan.txt +2 -0
- data/golden/schema_imports_multiple/expected/lir_00_unoptimized.txt +29 -0
- data/golden/schema_imports_multiple/expected/lir_01_hoist_scalar_references.txt +29 -0
- data/golden/schema_imports_multiple/expected/lir_02_inlined.txt +41 -0
- data/golden/schema_imports_multiple/expected/lir_03_cse.txt +37 -0
- data/golden/schema_imports_multiple/expected/lir_04_1_loop_fusion.txt +37 -0
- data/golden/schema_imports_multiple/expected/lir_04_loop_invcm.txt +37 -0
- data/golden/schema_imports_multiple/expected/lir_06_const_prop.txt +37 -0
- data/golden/schema_imports_multiple/expected/nast.txt +28 -0
- data/golden/schema_imports_multiple/expected/schema_javascript.mjs +40 -0
- data/golden/schema_imports_multiple/expected/schema_ruby.rb +37 -0
- data/golden/schema_imports_multiple/expected/snast.txt +28 -0
- data/golden/schema_imports_multiple/expected.json +7 -0
- data/golden/schema_imports_multiple/input.json +4 -0
- data/golden/schema_imports_multiple/schema.kumi +15 -0
- data/golden/schema_imports_nested_expressions/expected/ast.txt +31 -0
- data/golden/schema_imports_nested_expressions/expected/input_plan.txt +3 -0
- data/golden/schema_imports_nested_expressions/expected/lir_00_unoptimized.txt +22 -0
- data/golden/schema_imports_nested_expressions/expected/lir_01_hoist_scalar_references.txt +22 -0
- data/golden/schema_imports_nested_expressions/expected/lir_02_inlined.txt +32 -0
- data/golden/schema_imports_nested_expressions/expected/lir_03_cse.txt +32 -0
- data/golden/schema_imports_nested_expressions/expected/lir_04_1_loop_fusion.txt +32 -0
- data/golden/schema_imports_nested_expressions/expected/lir_04_loop_invcm.txt +32 -0
- data/golden/schema_imports_nested_expressions/expected/lir_06_const_prop.txt +28 -0
- data/golden/schema_imports_nested_expressions/expected/nast.txt +23 -0
- data/golden/schema_imports_nested_expressions/expected/schema_javascript.mjs +29 -0
- data/golden/schema_imports_nested_expressions/expected/schema_ruby.rb +28 -0
- data/golden/schema_imports_nested_expressions/expected/snast.txt +23 -0
- data/golden/schema_imports_nested_expressions/expected.json +5 -0
- data/golden/schema_imports_nested_expressions/input.json +5 -0
- data/golden/schema_imports_nested_expressions/schema.kumi +13 -0
- data/golden/schema_imports_nested_with_reductions/expected/ast.txt +47 -0
- data/golden/schema_imports_nested_with_reductions/expected/input_plan.txt +12 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_00_unoptimized.txt +31 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_01_hoist_scalar_references.txt +31 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_02_inlined.txt +58 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_03_cse.txt +49 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_04_1_loop_fusion.txt +51 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_04_loop_invcm.txt +49 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_06_const_prop.txt +49 -0
- data/golden/schema_imports_nested_with_reductions/expected/nast.txt +23 -0
- data/golden/schema_imports_nested_with_reductions/expected/schema_javascript.mjs +49 -0
- data/golden/schema_imports_nested_with_reductions/expected/schema_ruby.rb +52 -0
- data/golden/schema_imports_nested_with_reductions/expected/snast.txt +23 -0
- data/golden/schema_imports_nested_with_reductions/expected.json +6 -0
- data/golden/schema_imports_nested_with_reductions/input.json +16 -0
- data/golden/schema_imports_nested_with_reductions/schema.kumi +23 -0
- data/golden/schema_imports_with_imports/expected/ast.txt +19 -0
- data/golden/schema_imports_with_imports/expected/input_plan.txt +1 -0
- data/golden/schema_imports_with_imports/expected/lir_00_unoptimized.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_01_hoist_scalar_references.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_02_inlined.txt +14 -0
- data/golden/schema_imports_with_imports/expected/lir_03_cse.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_04_1_loop_fusion.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_04_loop_invcm.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_06_const_prop.txt +13 -0
- data/golden/schema_imports_with_imports/expected/nast.txt +13 -0
- data/golden/schema_imports_with_imports/expected/schema_javascript.mjs +13 -0
- data/golden/schema_imports_with_imports/expected/schema_ruby.rb +13 -0
- data/golden/schema_imports_with_imports/expected/snast.txt +13 -0
- data/golden/schema_imports_with_imports/expected.json +4 -0
- data/golden/schema_imports_with_imports/input.json +3 -0
- data/golden/schema_imports_with_imports/schema.kumi +10 -0
- data/golden/shift/expected/lir_06_const_prop.txt +18 -30
- data/golden/shift/expected/schema_javascript.mjs +18 -30
- data/golden/shift/expected/schema_ruby.rb +25 -67
- data/golden/shift_2d/expected/lir_06_const_prop.txt +36 -60
- data/golden/shift_2d/expected/schema_javascript.mjs +36 -60
- data/golden/shift_2d/expected/schema_ruby.rb +49 -109
- data/golden/simple_math/expected/lir_06_const_prop.txt +3 -6
- data/golden/simple_math/expected/schema_javascript.mjs +3 -6
- data/golden/simple_math/expected/schema_ruby.rb +8 -39
- data/golden/streaming_basics/expected/lir_06_const_prop.txt +6 -12
- data/golden/streaming_basics/expected/schema_javascript.mjs +6 -12
- data/golden/streaming_basics/expected/schema_ruby.rb +14 -51
- data/golden/tuples/expected/lir_06_const_prop.txt +5 -22
- data/golden/tuples/expected/schema_javascript.mjs +5 -22
- data/golden/tuples/expected/schema_ruby.rb +11 -57
- data/golden/tuples_and_arrays/expected/lir_06_const_prop.txt +4 -8
- data/golden/tuples_and_arrays/expected/schema_javascript.mjs +4 -8
- data/golden/tuples_and_arrays/expected/schema_ruby.rb +9 -41
- data/golden/us_tax_2024/expected/lir_06_const_prop.txt +94 -171
- data/golden/us_tax_2024/expected/schema_javascript.mjs +13 -21
- data/golden/us_tax_2024/expected/schema_ruby.rb +15 -48
- data/golden/with_constants/expected/lir_06_const_prop.txt +3 -8
- data/golden/with_constants/expected/schema_javascript.mjs +3 -8
- data/golden/with_constants/expected/schema_ruby.rb +5 -35
- data/lib/kumi/analyzer.rb +8 -7
- data/lib/kumi/configuration.rb +7 -6
- data/lib/kumi/core/analyzer/passes/attach_anchors_pass.rb +1 -1
- data/lib/kumi/core/analyzer/passes/attach_terminal_info_pass.rb +1 -1
- data/lib/kumi/core/analyzer/passes/codegen/js/declaration_emitter.rb +20 -0
- data/lib/kumi/core/analyzer/passes/codegen/ruby/declaration_emitter.rb +16 -7
- data/lib/kumi/core/analyzer/passes/codegen/ruby/output_buffer.rb +3 -35
- data/lib/kumi/core/analyzer/passes/dependency_resolver.rb +6 -0
- data/lib/kumi/core/analyzer/passes/import_analysis_pass.rb +90 -0
- data/lib/kumi/core/analyzer/passes/lir/constant_propagation_pass.rb +77 -36
- data/lib/kumi/core/analyzer/passes/lir/lower_pass.rb +26 -11
- data/lib/kumi/core/analyzer/passes/name_indexer.rb +20 -2
- data/lib/kumi/core/analyzer/passes/nast_dimensional_analyzer_pass.rb +44 -0
- data/lib/kumi/core/analyzer/passes/normalize_to_nast_pass.rb +30 -0
- data/lib/kumi/core/analyzer/passes/semantic_constraint_validator.rb +5 -1
- data/lib/kumi/core/analyzer/passes/snast_pass.rb +15 -0
- data/lib/kumi/core/lir/build.rb +27 -0
- data/lib/kumi/core/lir/peephole.rb +164 -0
- data/lib/kumi/core/nast.rb +16 -0
- data/lib/kumi/core/ruby_parser/build_context.rb +3 -1
- data/lib/kumi/core/ruby_parser/parser.rb +1 -1
- data/lib/kumi/core/ruby_parser/schema_builder.rb +33 -3
- data/lib/kumi/dev/golden/result.rb +9 -3
- data/lib/kumi/dev/golden/runtime_test.rb +16 -1
- data/lib/kumi/dev/golden.rb +18 -20
- data/lib/kumi/dev/golden_schema_modules.rb +8 -0
- data/lib/kumi/dev/golden_schema_wrapper.rb +116 -0
- data/lib/kumi/dev/support/kumi_runner.mjs +18 -0
- data/lib/kumi/schema.rb +44 -2
- data/lib/kumi/support/lir_printer.rb +21 -5
- data/lib/kumi/support/nast_printer.rb +11 -0
- data/lib/kumi/support/s_expression_printer.rb +9 -0
- data/lib/kumi/support/snast_printer.rb +6 -0
- data/lib/kumi/syntax/import_call.rb +11 -0
- data/lib/kumi/syntax/import_declaration.rb +11 -0
- data/lib/kumi/syntax/root.rb +2 -2
- data/lib/kumi/test_shared_schemas/compound.rb +21 -0
- data/lib/kumi/test_shared_schemas/discount.rb +19 -0
- data/lib/kumi/test_shared_schemas/price.rb +19 -0
- data/lib/kumi/test_shared_schemas/subtotal.rb +22 -0
- data/lib/kumi/test_shared_schemas/tax.rb +18 -0
- data/lib/kumi/version.rb +1 -1
- data/lib/kumi.rb +19 -4
- metadata +176 -3
|
@@ -2,25 +2,18 @@ export function _next_state(input) {
|
|
|
2
2
|
let out = [];
|
|
3
3
|
let t285 = input["rows"];
|
|
4
4
|
let t1548 = t285.length;
|
|
5
|
-
|
|
6
|
-
const t1551 = 0;
|
|
7
|
-
const t1555 = 1;
|
|
8
|
-
const t1534 = 3;
|
|
9
|
-
const t1745 = 2;
|
|
10
|
-
const t1952 = 0;
|
|
11
|
-
const t291 = 1;
|
|
12
|
-
let t1556 = t1548 - t1555;
|
|
5
|
+
let t1556 = t1548 - 1;
|
|
13
6
|
t285.forEach((rows_el_286, rows_i_287) => {
|
|
14
7
|
let out_1 = [];
|
|
15
|
-
let t1550 = rows_i_287 -
|
|
16
|
-
let t1570 = rows_i_287 -
|
|
8
|
+
let t1550 = rows_i_287 - -1;
|
|
9
|
+
let t1570 = rows_i_287 - 1;
|
|
17
10
|
let t1589 = ((rows_i_287 % t1548) + t1548) % t1548;
|
|
18
|
-
let t1552 = t1550 >=
|
|
11
|
+
let t1552 = t1550 >= 0;
|
|
19
12
|
let t1553 = t1550 < t1548;
|
|
20
|
-
let t1558 = Math.min(Math.max(t1550,
|
|
21
|
-
let t1572 = t1570 >=
|
|
13
|
+
let t1558 = Math.min(Math.max(t1550, 0), t1556);
|
|
14
|
+
let t1572 = t1570 >= 0;
|
|
22
15
|
let t1573 = t1570 < t1548;
|
|
23
|
-
let t1578 = Math.min(Math.max(t1570,
|
|
16
|
+
let t1578 = Math.min(Math.max(t1570, 0), t1556);
|
|
24
17
|
let t1590 = t1589 + t1548;
|
|
25
18
|
let t1554 = t1552 && t1553;
|
|
26
19
|
let t1559 = t285[t1558];
|
|
@@ -31,66 +24,66 @@ export function _next_state(input) {
|
|
|
31
24
|
let t1580 = t1579.length;
|
|
32
25
|
let t1592 = t285[t1591];
|
|
33
26
|
let t1593 = t1592.length;
|
|
34
|
-
let t1649 = t1560 -
|
|
35
|
-
let t1705 = t1580 -
|
|
36
|
-
let t1601 = t1593 -
|
|
27
|
+
let t1649 = t1560 - 1;
|
|
28
|
+
let t1705 = t1580 - 1;
|
|
29
|
+
let t1601 = t1593 - 1;
|
|
37
30
|
rows_el_286.forEach((col_el_288, col_i_289) => {
|
|
38
31
|
let t1561 = ((col_i_289 % t1560) + t1560) % t1560;
|
|
39
32
|
let t1562 = t1561 + t1560;
|
|
40
33
|
let t1563 = ((t1562 % t1560) + t1560) % t1560;
|
|
41
34
|
let t1564 = t1559[t1563];
|
|
42
|
-
let t1566 = t1554 ? t1564 :
|
|
35
|
+
let t1566 = t1554 ? t1564 : 0;
|
|
43
36
|
let t1581 = ((col_i_289 % t1580) + t1580) % t1580;
|
|
44
37
|
let t1582 = t1581 + t1580;
|
|
45
38
|
let t1583 = ((t1582 % t1580) + t1580) % t1580;
|
|
46
39
|
let t1584 = t1579[t1583];
|
|
47
|
-
let t1586 = t1574 ? t1584 :
|
|
48
|
-
let t1595 = col_i_289 -
|
|
49
|
-
let t1597 = t1595 >=
|
|
40
|
+
let t1586 = t1574 ? t1584 : 0;
|
|
41
|
+
let t1595 = col_i_289 - -1;
|
|
42
|
+
let t1597 = t1595 >= 0;
|
|
50
43
|
let t1598 = t1595 < t1593;
|
|
51
44
|
let t1599 = t1597 && t1598;
|
|
52
|
-
let t1603 = Math.min(Math.max(t1595,
|
|
45
|
+
let t1603 = Math.min(Math.max(t1595, 0), t1601);
|
|
53
46
|
let t1604 = t1592[t1603];
|
|
54
|
-
let t1606 = t1599 ? t1604 :
|
|
55
|
-
let t1615 = col_i_289 -
|
|
56
|
-
let t1617 = t1615 >=
|
|
47
|
+
let t1606 = t1599 ? t1604 : 0;
|
|
48
|
+
let t1615 = col_i_289 - 1;
|
|
49
|
+
let t1617 = t1615 >= 0;
|
|
57
50
|
let t1618 = t1615 < t1593;
|
|
58
51
|
let t1619 = t1617 && t1618;
|
|
59
|
-
let t1623 = Math.min(Math.max(t1615,
|
|
52
|
+
let t1623 = Math.min(Math.max(t1615, 0), t1601);
|
|
60
53
|
let t1624 = t1592[t1623];
|
|
61
|
-
let t1626 = t1619 ? t1624 :
|
|
54
|
+
let t1626 = t1619 ? t1624 : 0;
|
|
62
55
|
let t1645 = t1595 < t1560;
|
|
63
56
|
let t1646 = t1597 && t1645;
|
|
64
57
|
let t1647 = t1554 && t1646;
|
|
65
|
-
let t1651 = Math.min(Math.max(t1595,
|
|
58
|
+
let t1651 = Math.min(Math.max(t1595, 0), t1649);
|
|
66
59
|
let t1652 = t1559[t1651];
|
|
67
|
-
let t1654 = t1647 ? t1652 :
|
|
60
|
+
let t1654 = t1647 ? t1652 : 0;
|
|
68
61
|
let t1673 = t1615 < t1560;
|
|
69
62
|
let t1674 = t1617 && t1673;
|
|
70
63
|
let t1675 = t1554 && t1674;
|
|
71
|
-
let t1679 = Math.min(Math.max(t1615,
|
|
64
|
+
let t1679 = Math.min(Math.max(t1615, 0), t1649);
|
|
72
65
|
let t1680 = t1559[t1679];
|
|
73
|
-
let t1682 = t1675 ? t1680 :
|
|
66
|
+
let t1682 = t1675 ? t1680 : 0;
|
|
74
67
|
let t1701 = t1595 < t1580;
|
|
75
68
|
let t1702 = t1597 && t1701;
|
|
76
69
|
let t1703 = t1574 && t1702;
|
|
77
|
-
let t1707 = Math.min(Math.max(t1595,
|
|
70
|
+
let t1707 = Math.min(Math.max(t1595, 0), t1705);
|
|
78
71
|
let t1708 = t1579[t1707];
|
|
79
|
-
let t1710 = t1703 ? t1708 :
|
|
72
|
+
let t1710 = t1703 ? t1708 : 0;
|
|
80
73
|
let t1729 = t1615 < t1580;
|
|
81
74
|
let t1730 = t1617 && t1729;
|
|
82
75
|
let t1731 = t1574 && t1730;
|
|
83
|
-
let t1735 = Math.min(Math.max(t1615,
|
|
76
|
+
let t1735 = Math.min(Math.max(t1615, 0), t1705);
|
|
84
77
|
let t1736 = t1579[t1735];
|
|
85
|
-
let t1738 = t1731 ? t1736 :
|
|
78
|
+
let t1738 = t1731 ? t1736 : 0;
|
|
86
79
|
let t1545 = [t1566, t1586, t1606, t1626, t1654, t1682, t1710, t1738];
|
|
87
80
|
let t1546 = t1545.reduce((a, b) => a + b, 0);
|
|
88
|
-
let t1535 = t1546 ==
|
|
89
|
-
let t1746 = t1546 ==
|
|
90
|
-
let t1953 = col_el_288 >
|
|
81
|
+
let t1535 = t1546 == 3;
|
|
82
|
+
let t1746 = t1546 == 2;
|
|
83
|
+
let t1953 = col_el_288 > 0;
|
|
91
84
|
let t1742 = t1746 && t1953;
|
|
92
85
|
let t1531 = t1535 || t1742;
|
|
93
|
-
let t293 = t1531 ?
|
|
86
|
+
let t293 = t1531 ? 1 : 0;
|
|
94
87
|
out_1.push(t293);
|
|
95
88
|
});
|
|
96
89
|
out.push(out_1);
|
|
@@ -1,53 +1,21 @@
|
|
|
1
1
|
# Autogenerated by Kumi Codegen
|
|
2
|
-
module Kumi::Compiled::
|
|
3
|
-
def self.
|
|
4
|
-
instance = Object.new
|
|
5
|
-
instance.extend(self)
|
|
6
|
-
instance.instance_variable_set(:@input, input_data)
|
|
7
|
-
instance
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def self.__kumi_executable__
|
|
11
|
-
instance = Object.new
|
|
12
|
-
instance.extend(self)
|
|
13
|
-
instance
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def update(input_data)
|
|
17
|
-
@input = @input.merge(input_data)
|
|
18
|
-
self
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def [](name)
|
|
22
|
-
case name
|
|
23
|
-
when :next_state then _next_state
|
|
24
|
-
else raise KeyError, "Unknown declaration"
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def _next_state(input = @input)
|
|
2
|
+
module Kumi::Compiled::KUMI_5bbfe4bf28c656f1df22503b4412e8871a2a4e92d92ede753da4ae8639bcf51a
|
|
3
|
+
def self._next_state(input)
|
|
29
4
|
out = []
|
|
30
5
|
t285 = input["rows"] || input[:rows]
|
|
31
6
|
t1548 = t285.length
|
|
32
|
-
|
|
33
|
-
t1551 = 0
|
|
34
|
-
t1555 = 1
|
|
35
|
-
t1534 = 3
|
|
36
|
-
t1745 = 2
|
|
37
|
-
t1952 = 0
|
|
38
|
-
t291 = 1
|
|
39
|
-
t1556 = t1548 - t1555
|
|
7
|
+
t1556 = t1548 - 1
|
|
40
8
|
t285.each_with_index do |rows_el_286, rows_i_287|
|
|
41
9
|
out_1 = []
|
|
42
|
-
t1550 = rows_i_287 -
|
|
43
|
-
t1570 = rows_i_287 -
|
|
10
|
+
t1550 = rows_i_287 - -1
|
|
11
|
+
t1570 = rows_i_287 - 1
|
|
44
12
|
t1589 = rows_i_287 % t1548
|
|
45
|
-
t1552 = t1550 >=
|
|
13
|
+
t1552 = t1550 >= 0
|
|
46
14
|
t1553 = t1550 < t1548
|
|
47
|
-
t1558 =
|
|
48
|
-
t1572 = t1570 >=
|
|
15
|
+
t1558 = t1550.clamp(0, t1556)
|
|
16
|
+
t1572 = t1570 >= 0
|
|
49
17
|
t1573 = t1570 < t1548
|
|
50
|
-
t1578 =
|
|
18
|
+
t1578 = t1570.clamp(0, t1556)
|
|
51
19
|
t1590 = t1589 + t1548
|
|
52
20
|
t1554 = t1552 && t1553
|
|
53
21
|
t1559 = t285[t1558]
|
|
@@ -58,66 +26,66 @@ module Kumi::Compiled::KUMI_da8a14f5173aeacc57a51c4ce575639861c36278e0af1886b534
|
|
|
58
26
|
t1580 = t1579.length
|
|
59
27
|
t1592 = t285[t1591]
|
|
60
28
|
t1593 = t1592.length
|
|
61
|
-
t1649 = t1560 -
|
|
62
|
-
t1705 = t1580 -
|
|
63
|
-
t1601 = t1593 -
|
|
29
|
+
t1649 = t1560 - 1
|
|
30
|
+
t1705 = t1580 - 1
|
|
31
|
+
t1601 = t1593 - 1
|
|
64
32
|
rows_el_286.each_with_index do |col_el_288, col_i_289|
|
|
65
33
|
t1561 = col_i_289 % t1560
|
|
66
34
|
t1562 = t1561 + t1560
|
|
67
35
|
t1563 = t1562 % t1560
|
|
68
36
|
t1564 = t1559[t1563]
|
|
69
|
-
t1566 = t1554 ? t1564 :
|
|
37
|
+
t1566 = t1554 ? t1564 : 0
|
|
70
38
|
t1581 = col_i_289 % t1580
|
|
71
39
|
t1582 = t1581 + t1580
|
|
72
40
|
t1583 = t1582 % t1580
|
|
73
41
|
t1584 = t1579[t1583]
|
|
74
|
-
t1586 = t1574 ? t1584 :
|
|
75
|
-
t1595 = col_i_289 -
|
|
76
|
-
t1597 = t1595 >=
|
|
42
|
+
t1586 = t1574 ? t1584 : 0
|
|
43
|
+
t1595 = col_i_289 - -1
|
|
44
|
+
t1597 = t1595 >= 0
|
|
77
45
|
t1598 = t1595 < t1593
|
|
78
46
|
t1599 = t1597 && t1598
|
|
79
|
-
t1603 =
|
|
47
|
+
t1603 = t1595.clamp(0, t1601)
|
|
80
48
|
t1604 = t1592[t1603]
|
|
81
|
-
t1606 = t1599 ? t1604 :
|
|
82
|
-
t1615 = col_i_289 -
|
|
83
|
-
t1617 = t1615 >=
|
|
49
|
+
t1606 = t1599 ? t1604 : 0
|
|
50
|
+
t1615 = col_i_289 - 1
|
|
51
|
+
t1617 = t1615 >= 0
|
|
84
52
|
t1618 = t1615 < t1593
|
|
85
53
|
t1619 = t1617 && t1618
|
|
86
|
-
t1623 =
|
|
54
|
+
t1623 = t1615.clamp(0, t1601)
|
|
87
55
|
t1624 = t1592[t1623]
|
|
88
|
-
t1626 = t1619 ? t1624 :
|
|
56
|
+
t1626 = t1619 ? t1624 : 0
|
|
89
57
|
t1645 = t1595 < t1560
|
|
90
58
|
t1646 = t1597 && t1645
|
|
91
59
|
t1647 = t1554 && t1646
|
|
92
|
-
t1651 =
|
|
60
|
+
t1651 = t1595.clamp(0, t1649)
|
|
93
61
|
t1652 = t1559[t1651]
|
|
94
|
-
t1654 = t1647 ? t1652 :
|
|
62
|
+
t1654 = t1647 ? t1652 : 0
|
|
95
63
|
t1673 = t1615 < t1560
|
|
96
64
|
t1674 = t1617 && t1673
|
|
97
65
|
t1675 = t1554 && t1674
|
|
98
|
-
t1679 =
|
|
66
|
+
t1679 = t1615.clamp(0, t1649)
|
|
99
67
|
t1680 = t1559[t1679]
|
|
100
|
-
t1682 = t1675 ? t1680 :
|
|
68
|
+
t1682 = t1675 ? t1680 : 0
|
|
101
69
|
t1701 = t1595 < t1580
|
|
102
70
|
t1702 = t1597 && t1701
|
|
103
71
|
t1703 = t1574 && t1702
|
|
104
|
-
t1707 =
|
|
72
|
+
t1707 = t1595.clamp(0, t1705)
|
|
105
73
|
t1708 = t1579[t1707]
|
|
106
|
-
t1710 = t1703 ? t1708 :
|
|
74
|
+
t1710 = t1703 ? t1708 : 0
|
|
107
75
|
t1729 = t1615 < t1580
|
|
108
76
|
t1730 = t1617 && t1729
|
|
109
77
|
t1731 = t1574 && t1730
|
|
110
|
-
t1735 =
|
|
78
|
+
t1735 = t1615.clamp(0, t1705)
|
|
111
79
|
t1736 = t1579[t1735]
|
|
112
|
-
t1738 = t1731 ? t1736 :
|
|
80
|
+
t1738 = t1731 ? t1736 : 0
|
|
113
81
|
t1545 = [t1566, t1586, t1606, t1626, t1654, t1682, t1710, t1738]
|
|
114
82
|
t1546 = t1545.sum
|
|
115
|
-
t1535 = t1546 ==
|
|
116
|
-
t1746 = t1546 ==
|
|
117
|
-
t1953 = col_el_288 >
|
|
83
|
+
t1535 = t1546 == 3
|
|
84
|
+
t1746 = t1546 == 2
|
|
85
|
+
t1953 = col_el_288 > 0
|
|
118
86
|
t1742 = t1746 && t1953
|
|
119
87
|
t1531 = t1535 || t1742
|
|
120
|
-
t293 = t1531 ?
|
|
88
|
+
t293 = t1531 ? 1 : 0
|
|
121
89
|
out_1 << t293
|
|
122
90
|
end
|
|
123
91
|
out << out_1
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
(LIR
|
|
2
2
|
(Declaration meta
|
|
3
|
-
%t1 = const "grid2d" :: string
|
|
4
3
|
%t2 = load_input "width" :: integer
|
|
5
4
|
%t3 = load_input "height" :: integer
|
|
6
5
|
%t4 = make_object{width: %t2, height: %t3} :: object
|
|
7
|
-
%
|
|
8
|
-
%
|
|
9
|
-
%
|
|
10
|
-
%
|
|
11
|
-
%t9 = const "#0f1219" :: string
|
|
12
|
-
%t10 = const "#10b981" :: string
|
|
13
|
-
%t11 = make_object{0: %t9, 1: %t10} :: object
|
|
14
|
-
%t12 = make_object{cellSize: %t8, palette: %t11} :: object
|
|
15
|
-
%t13 = make_object{render: %t1, size: %t4, prefill: %t7, ui: %t12} :: object
|
|
6
|
+
%t7 = make_object{random: %__immediate_placeholder__, 0.3: %__immediate_placeholder__, kind: nil, density: nil} :: object
|
|
7
|
+
%t11 = make_object{#0f1219: %__immediate_placeholder__, #10b981: %__immediate_placeholder__, 0: nil, 1: nil} :: object
|
|
8
|
+
%t12 = make_object{10: %__immediate_placeholder__, cellSize: %t11, palette: nil} :: object
|
|
9
|
+
%t13 = make_object{grid2d: %__immediate_placeholder__, render: %t4, size: %t7, prefill: %t12, ui: nil} :: object
|
|
16
10
|
yield %t13
|
|
17
11
|
)
|
|
18
12
|
)
|
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
export function _meta(input) {
|
|
2
|
-
const t1 = "grid2d";
|
|
3
2
|
let t2 = input["width"];
|
|
4
3
|
let t3 = input["height"];
|
|
5
4
|
let t4 = {
|
|
6
5
|
"width": t2,
|
|
7
6
|
"height": t3
|
|
8
7
|
};
|
|
9
|
-
const t5 = "random";
|
|
10
|
-
const t6 = 0.3;
|
|
11
8
|
let t7 = {
|
|
12
|
-
"kind":
|
|
13
|
-
"density":
|
|
9
|
+
"kind": "random",
|
|
10
|
+
"density": 0.3
|
|
14
11
|
};
|
|
15
|
-
const t8 = 10;
|
|
16
|
-
const t9 = "#0f1219";
|
|
17
|
-
const t10 = "#10b981";
|
|
18
12
|
let t11 = {
|
|
19
|
-
"0":
|
|
20
|
-
"1":
|
|
13
|
+
"0": "#0f1219",
|
|
14
|
+
"1": "#10b981"
|
|
21
15
|
};
|
|
22
16
|
let t12 = {
|
|
23
|
-
"cellSize":
|
|
17
|
+
"cellSize": 10,
|
|
24
18
|
"palette": t11
|
|
25
19
|
};
|
|
26
20
|
let t13 = {
|
|
27
|
-
"render":
|
|
21
|
+
"render": "grid2d",
|
|
28
22
|
"size": t4,
|
|
29
23
|
"prefill": t7,
|
|
30
24
|
"ui": t12
|
|
@@ -1,57 +1,26 @@
|
|
|
1
1
|
# Autogenerated by Kumi Codegen
|
|
2
|
-
module Kumi::Compiled::
|
|
3
|
-
def self.
|
|
4
|
-
instance = Object.new
|
|
5
|
-
instance.extend(self)
|
|
6
|
-
instance.instance_variable_set(:@input, input_data)
|
|
7
|
-
instance
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def self.__kumi_executable__
|
|
11
|
-
instance = Object.new
|
|
12
|
-
instance.extend(self)
|
|
13
|
-
instance
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def update(input_data)
|
|
17
|
-
@input = @input.merge(input_data)
|
|
18
|
-
self
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def [](name)
|
|
22
|
-
case name
|
|
23
|
-
when :meta then _meta
|
|
24
|
-
else raise KeyError, "Unknown declaration"
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def _meta(input = @input)
|
|
29
|
-
t1 = "grid2d"
|
|
2
|
+
module Kumi::Compiled::KUMI_886bab866ea4f5ef1d52910f9fd141773dd27be56e96c337fb54ded49d90b32f
|
|
3
|
+
def self._meta(input)
|
|
30
4
|
t2 = input["width"] || input[:width]
|
|
31
5
|
t3 = input["height"] || input[:height]
|
|
32
6
|
t4 = {
|
|
33
7
|
"width" => t2,
|
|
34
8
|
"height" => t3
|
|
35
9
|
}
|
|
36
|
-
t5 = "random"
|
|
37
|
-
t6 = 0.3
|
|
38
10
|
t7 = {
|
|
39
|
-
"kind" =>
|
|
40
|
-
"density" =>
|
|
11
|
+
"kind" => "random",
|
|
12
|
+
"density" => 0.3
|
|
41
13
|
}
|
|
42
|
-
t8 = 10
|
|
43
|
-
t9 = "#0f1219"
|
|
44
|
-
t10 = "#10b981"
|
|
45
14
|
t11 = {
|
|
46
|
-
"0" =>
|
|
47
|
-
"1" =>
|
|
15
|
+
"0" => "#0f1219",
|
|
16
|
+
"1" => "#10b981"
|
|
48
17
|
}
|
|
49
18
|
t12 = {
|
|
50
|
-
"cellSize" =>
|
|
19
|
+
"cellSize" => 10,
|
|
51
20
|
"palette" => t11
|
|
52
21
|
}
|
|
53
22
|
t13 = {
|
|
54
|
-
"render" =>
|
|
23
|
+
"render" => "grid2d",
|
|
55
24
|
"size" => t4,
|
|
56
25
|
"prefill" => t7,
|
|
57
26
|
"ui" => t12
|
|
@@ -10,23 +10,20 @@
|
|
|
10
10
|
)
|
|
11
11
|
(Declaration is_john
|
|
12
12
|
%t7 = load_input "users" :: array
|
|
13
|
-
%t11 = const "John" :: string
|
|
14
13
|
loop users id=L2 in %t7 as el=%users_el_8, idx=%users_i_9
|
|
15
14
|
%t10 = load_field users_el_8["name"] :: string
|
|
16
|
-
%t12 = call core.eq(%t10,
|
|
15
|
+
%t12 = call core.eq(%t10, "John") :: boolean
|
|
17
16
|
yield %t12
|
|
18
17
|
end_loop
|
|
19
18
|
)
|
|
20
19
|
(Declaration john_user
|
|
21
20
|
%t13 = load_input "users" :: array
|
|
22
|
-
%t22 = const "John" :: string
|
|
23
|
-
%t18 = const "NOT_JOHN" :: string
|
|
24
21
|
loop users id=L3 in %t13 as el=%users_el_14, idx=%users_i_15
|
|
25
22
|
%t21 = load_field users_el_14["name"] :: string
|
|
26
23
|
%t26 = load_field users_el_14["state"] :: string
|
|
27
|
-
%t23 = call core.eq(%t21,
|
|
24
|
+
%t23 = call core.eq(%t21, "John") :: boolean
|
|
28
25
|
%t27 = make_object{name: %t21, state: %t26} :: object
|
|
29
|
-
%t19 = select %t23, %t27,
|
|
26
|
+
%t19 = select %t23, %t27, "NOT_JOHN" :: hash
|
|
30
27
|
yield %t19
|
|
31
28
|
end_loop
|
|
32
29
|
)
|
|
@@ -16,10 +16,9 @@ export function _users(input) {
|
|
|
16
16
|
export function _is_john(input) {
|
|
17
17
|
let out = [];
|
|
18
18
|
let t7 = input["users"];
|
|
19
|
-
const t11 = "John";
|
|
20
19
|
t7.forEach((users_el_8, users_i_9) => {
|
|
21
20
|
let t10 = users_el_8["name"];
|
|
22
|
-
let t12 = t10 ==
|
|
21
|
+
let t12 = t10 == "John";
|
|
23
22
|
out.push(t12);
|
|
24
23
|
});
|
|
25
24
|
return out;
|
|
@@ -28,17 +27,15 @@ export function _is_john(input) {
|
|
|
28
27
|
export function _john_user(input) {
|
|
29
28
|
let out = [];
|
|
30
29
|
let t13 = input["users"];
|
|
31
|
-
const t22 = "John";
|
|
32
|
-
const t18 = "NOT_JOHN";
|
|
33
30
|
t13.forEach((users_el_14, users_i_15) => {
|
|
34
31
|
let t21 = users_el_14["name"];
|
|
35
32
|
let t26 = users_el_14["state"];
|
|
36
|
-
let t23 = t21 ==
|
|
33
|
+
let t23 = t21 == "John";
|
|
37
34
|
let t27 = {
|
|
38
35
|
"name": t21,
|
|
39
36
|
"state": t26
|
|
40
37
|
};
|
|
41
|
-
let t19 = t23 ? t27 :
|
|
38
|
+
let t19 = t23 ? t27 : "NOT_JOHN";
|
|
42
39
|
out.push(t19);
|
|
43
40
|
});
|
|
44
41
|
return out;
|
|
@@ -1,33 +1,6 @@
|
|
|
1
1
|
# Autogenerated by Kumi Codegen
|
|
2
|
-
module Kumi::Compiled::
|
|
3
|
-
def self.
|
|
4
|
-
instance = Object.new
|
|
5
|
-
instance.extend(self)
|
|
6
|
-
instance.instance_variable_set(:@input, input_data)
|
|
7
|
-
instance
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def self.__kumi_executable__
|
|
11
|
-
instance = Object.new
|
|
12
|
-
instance.extend(self)
|
|
13
|
-
instance
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def update(input_data)
|
|
17
|
-
@input = @input.merge(input_data)
|
|
18
|
-
self
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def [](name)
|
|
22
|
-
case name
|
|
23
|
-
when :users then _users
|
|
24
|
-
when :is_john then _is_john
|
|
25
|
-
when :john_user then _john_user
|
|
26
|
-
else raise KeyError, "Unknown declaration"
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def _users(input = @input)
|
|
2
|
+
module Kumi::Compiled::KUMI_e1770a87f5908c45ce123c37f83a13dd10f3651397af4f75453392061c62fb24
|
|
3
|
+
def self._users(input)
|
|
31
4
|
out = []
|
|
32
5
|
t1 = input["users"] || input[:users]
|
|
33
6
|
t1.each_with_index do |users_el_2, users_i_3|
|
|
@@ -42,32 +15,29 @@ module Kumi::Compiled::KUMI_20851df9e37717955d2f6618a6c66f18be4297a15b09489940b5
|
|
|
42
15
|
out
|
|
43
16
|
end
|
|
44
17
|
|
|
45
|
-
def _is_john(input
|
|
18
|
+
def self._is_john(input)
|
|
46
19
|
out = []
|
|
47
20
|
t7 = input["users"] || input[:users]
|
|
48
|
-
t11 = "John"
|
|
49
21
|
t7.each_with_index do |users_el_8, users_i_9|
|
|
50
22
|
t10 = users_el_8["name"] || users_el_8[:name]
|
|
51
|
-
t12 = t10 ==
|
|
23
|
+
t12 = t10 == "John"
|
|
52
24
|
out << t12
|
|
53
25
|
end
|
|
54
26
|
out
|
|
55
27
|
end
|
|
56
28
|
|
|
57
|
-
def _john_user(input
|
|
29
|
+
def self._john_user(input)
|
|
58
30
|
out = []
|
|
59
31
|
t13 = input["users"] || input[:users]
|
|
60
|
-
t22 = "John"
|
|
61
|
-
t18 = "NOT_JOHN"
|
|
62
32
|
t13.each_with_index do |users_el_14, users_i_15|
|
|
63
33
|
t21 = users_el_14["name"] || users_el_14[:name]
|
|
64
34
|
t26 = users_el_14["state"] || users_el_14[:state]
|
|
65
|
-
t23 = t21 ==
|
|
35
|
+
t23 = t21 == "John"
|
|
66
36
|
t27 = {
|
|
67
37
|
"name" => t21,
|
|
68
38
|
"state" => t26
|
|
69
39
|
}
|
|
70
|
-
t19 = t23 ? t27 :
|
|
40
|
+
t19 = t23 ? t27 : "NOT_JOHN"
|
|
71
41
|
out << t19
|
|
72
42
|
end
|
|
73
43
|
out
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
(LIR
|
|
2
2
|
(Declaration high_performer
|
|
3
3
|
%t1 = load_input "regions" :: array
|
|
4
|
-
%t14 = const 4.5 :: float
|
|
5
4
|
loop regions id=L1 in %t1 as el=%regions_el_2, idx=%regions_i_3
|
|
6
5
|
%t4 = load_field regions_el_2["offices"] :: any
|
|
7
6
|
loop offices id=L2 in %t4 as el=%offices_el_5, idx=%offices_i_6
|
|
@@ -10,7 +9,7 @@
|
|
|
10
9
|
%t10 = load_field teams_el_8["employees"] :: any
|
|
11
10
|
loop employees id=L4 in %t10 as el=%employees_el_11, idx=%employees_i_12
|
|
12
11
|
%t13 = load_field employees_el_11["rating"] :: float
|
|
13
|
-
%t15 = call core.gte(%t13,
|
|
12
|
+
%t15 = call core.gte(%t13, 4.5) :: boolean
|
|
14
13
|
yield %t15
|
|
15
14
|
end_loop
|
|
16
15
|
end_loop
|
|
@@ -19,7 +18,6 @@
|
|
|
19
18
|
)
|
|
20
19
|
(Declaration senior_level
|
|
21
20
|
%t16 = load_input "regions" :: array
|
|
22
|
-
%t29 = const "senior" :: string
|
|
23
21
|
loop regions id=L5 in %t16 as el=%regions_el_17, idx=%regions_i_18
|
|
24
22
|
%t19 = load_field regions_el_17["offices"] :: any
|
|
25
23
|
loop offices id=L6 in %t19 as el=%offices_el_20, idx=%offices_i_21
|
|
@@ -28,7 +26,7 @@
|
|
|
28
26
|
%t25 = load_field teams_el_23["employees"] :: any
|
|
29
27
|
loop employees id=L8 in %t25 as el=%employees_el_26, idx=%employees_i_27
|
|
30
28
|
%t28 = load_field employees_el_26["level"] :: string
|
|
31
|
-
%t30 = call core.eq(%t28,
|
|
29
|
+
%t30 = call core.eq(%t28, "senior") :: boolean
|
|
32
30
|
yield %t30
|
|
33
31
|
end_loop
|
|
34
32
|
end_loop
|
|
@@ -37,14 +35,13 @@
|
|
|
37
35
|
)
|
|
38
36
|
(Declaration top_team
|
|
39
37
|
%t31 = load_input "regions" :: array
|
|
40
|
-
%t41 = const 0.9 :: float
|
|
41
38
|
loop regions id=L9 in %t31 as el=%regions_el_32, idx=%regions_i_33
|
|
42
39
|
%t34 = load_field regions_el_32["offices"] :: any
|
|
43
40
|
loop offices id=L10 in %t34 as el=%offices_el_35, idx=%offices_i_36
|
|
44
41
|
%t37 = load_field offices_el_35["teams"] :: any
|
|
45
42
|
loop teams id=L11 in %t37 as el=%teams_el_38, idx=%teams_i_39
|
|
46
43
|
%t40 = load_field teams_el_38["performance_score"] :: float
|
|
47
|
-
%t42 = call core.gte(%t40,
|
|
44
|
+
%t42 = call core.gte(%t40, 0.9) :: boolean
|
|
48
45
|
yield %t42
|
|
49
46
|
end_loop
|
|
50
47
|
end_loop
|
|
@@ -52,32 +49,26 @@
|
|
|
52
49
|
)
|
|
53
50
|
(Declaration employee_bonus
|
|
54
51
|
%t43 = load_input "regions" :: array
|
|
55
|
-
%t92 = const 0.9 :: float
|
|
56
|
-
%t79 = const 4.5 :: float
|
|
57
|
-
%t86 = const "senior" :: string
|
|
58
|
-
%t61 = const 0.3 :: float
|
|
59
|
-
%t67 = const 0.2 :: float
|
|
60
|
-
%t70 = const 0.05 :: float
|
|
61
52
|
loop regions id=L12 in %t43 as el=%regions_el_44, idx=%regions_i_45
|
|
62
53
|
%t46 = load_field regions_el_44["offices"] :: any
|
|
63
54
|
loop offices id=L13 in %t46 as el=%offices_el_47, idx=%offices_i_48
|
|
64
55
|
%t49 = load_field offices_el_47["teams"] :: any
|
|
65
56
|
loop teams id=L14 in %t49 as el=%teams_el_50, idx=%teams_i_51
|
|
66
57
|
%t91 = load_field teams_el_50["performance_score"] :: float
|
|
67
|
-
%t93 = call core.gte(%t91,
|
|
58
|
+
%t93 = call core.gte(%t91, 0.9) :: boolean
|
|
68
59
|
%t52 = load_field teams_el_50["employees"] :: any
|
|
69
60
|
loop employees id=L15 in %t52 as el=%employees_el_53, idx=%employees_i_54
|
|
70
61
|
%t78 = load_field employees_el_53["rating"] :: float
|
|
71
|
-
%t80 = call core.gte(%t78,
|
|
62
|
+
%t80 = call core.gte(%t78, 4.5) :: boolean
|
|
72
63
|
%t85 = load_field employees_el_53["level"] :: string
|
|
73
|
-
%t87 = call core.eq(%t85,
|
|
64
|
+
%t87 = call core.eq(%t85, "senior") :: boolean
|
|
74
65
|
%t58 = call core.and(%t87, %t93) :: boolean
|
|
75
66
|
%t59 = call core.and(%t80, %t58) :: boolean
|
|
76
67
|
%t60 = load_field employees_el_53["salary"] :: float
|
|
77
|
-
%t62 = call core.mul:numeric(%t60,
|
|
68
|
+
%t62 = call core.mul:numeric(%t60, 0.3) :: float
|
|
78
69
|
%t65 = call core.and(%t80, %t93) :: boolean
|
|
79
|
-
%t68 = call core.mul:numeric(%t60,
|
|
80
|
-
%t71 = call core.mul:numeric(%t60,
|
|
70
|
+
%t68 = call core.mul:numeric(%t60, 0.2) :: float
|
|
71
|
+
%t71 = call core.mul:numeric(%t60, 0.05) :: float
|
|
81
72
|
%t72 = select %t65, %t68, %t71 :: float
|
|
82
73
|
%t73 = select %t59, %t62, %t72 :: float
|
|
83
74
|
yield %t73
|