kumi 0.0.31 → 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
|
@@ -1,31 +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 :v_sum_y then _v_sum_y
|
|
24
|
-
else raise KeyError, "Unknown declaration"
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def _v_sum_y(input = @input)
|
|
2
|
+
module Kumi::Compiled::KUMI_5b3f1fa69196cf9b659e48d120f973c8d8c7e1db3205f6332fb3c76ef30284e8
|
|
3
|
+
def self._v_sum_y(input)
|
|
29
4
|
out = []
|
|
30
5
|
t1 = input["x"] || input[:x]
|
|
31
6
|
t1.each_with_index do |x_el_2, x_i_3|
|
|
@@ -7,27 +7,27 @@
|
|
|
7
7
|
(VALUE box
|
|
8
8
|
(Call :add
|
|
9
9
|
(Call :multiply
|
|
10
|
-
#<struct Kumi::Core::NAST::IndexRef id=
|
|
10
|
+
#<struct Kumi::Core::NAST::IndexRef id=138, loc=nil, meta={}>
|
|
11
11
|
(Ref W)
|
|
12
12
|
)
|
|
13
|
-
#<struct Kumi::Core::NAST::IndexRef id=
|
|
13
|
+
#<struct Kumi::Core::NAST::IndexRef id=142, loc=nil, meta={}>
|
|
14
14
|
)
|
|
15
15
|
)
|
|
16
16
|
(VALUE col_major
|
|
17
17
|
(Call :add
|
|
18
18
|
(Call :multiply
|
|
19
|
-
#<struct Kumi::Core::NAST::IndexRef id=
|
|
19
|
+
#<struct Kumi::Core::NAST::IndexRef id=146, loc=nil, meta={}>
|
|
20
20
|
(Call :array_size
|
|
21
21
|
(InputRef [:x])
|
|
22
22
|
)
|
|
23
23
|
)
|
|
24
|
-
#<struct Kumi::Core::NAST::IndexRef id=
|
|
24
|
+
#<struct Kumi::Core::NAST::IndexRef id=151, loc=nil, meta={}>
|
|
25
25
|
)
|
|
26
26
|
)
|
|
27
27
|
(VALUE sum_ij
|
|
28
28
|
(Call :add
|
|
29
|
-
#<struct Kumi::Core::NAST::IndexRef id=
|
|
30
|
-
#<struct Kumi::Core::NAST::IndexRef id=
|
|
29
|
+
#<struct Kumi::Core::NAST::IndexRef id=155, loc=nil, meta={}>
|
|
30
|
+
#<struct Kumi::Core::NAST::IndexRef id=157, loc=nil, meta={}>
|
|
31
31
|
)
|
|
32
32
|
)
|
|
33
33
|
)
|
|
@@ -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 :box then _box
|
|
24
|
-
when :col_major then _col_major
|
|
25
|
-
when :sum_ij then _sum_ij
|
|
26
|
-
else raise KeyError, "Unknown declaration"
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def _box(input = @input)
|
|
2
|
+
module Kumi::Compiled::KUMI_510650f83f69ad0965715b7dd0a0be819775493c2ce07cd501134489df18ef33
|
|
3
|
+
def self._box(input)
|
|
31
4
|
out = []
|
|
32
5
|
t5 = input["x"] || input[:x]
|
|
33
6
|
t5.each_with_index do |x_el_6, x_i_7|
|
|
@@ -43,7 +16,7 @@ module Kumi::Compiled::KUMI_db1e731032ea8c98ca0f2b4ae89d1cc32aeb5742ca64d0876db4
|
|
|
43
16
|
out
|
|
44
17
|
end
|
|
45
18
|
|
|
46
|
-
def _col_major(input
|
|
19
|
+
def self._col_major(input)
|
|
47
20
|
out = []
|
|
48
21
|
t13 = input["x"] || input[:x]
|
|
49
22
|
t19 = t13.length
|
|
@@ -59,7 +32,7 @@ module Kumi::Compiled::KUMI_db1e731032ea8c98ca0f2b4ae89d1cc32aeb5742ca64d0876db4
|
|
|
59
32
|
out
|
|
60
33
|
end
|
|
61
34
|
|
|
62
|
-
def _sum_ij(input
|
|
35
|
+
def self._sum_ij(input)
|
|
63
36
|
out = []
|
|
64
37
|
t22 = input["x"] || input[:x]
|
|
65
38
|
t22.each_with_index do |x_el_23, x_i_24|
|
|
@@ -10,37 +10,33 @@
|
|
|
10
10
|
)
|
|
11
11
|
(Declaration discounted_price
|
|
12
12
|
%t7 = load_input "items" :: array
|
|
13
|
-
%t11 = const 0.9 :: float
|
|
14
13
|
loop items id=L2 in %t7 as el=%items_el_8, idx=%items_i_9
|
|
15
14
|
%t10 = load_field items_el_8["price"] :: float
|
|
16
|
-
%t12 = call core.mul:numeric(%t10,
|
|
15
|
+
%t12 = call core.mul:numeric(%t10, 0.9) :: float
|
|
17
16
|
yield %t12
|
|
18
17
|
end_loop
|
|
19
18
|
)
|
|
20
19
|
(Declaration is_valid_quantity
|
|
21
20
|
%t13 = load_input "items" :: array
|
|
22
|
-
%t17 = const 0 :: integer
|
|
23
21
|
loop items id=L3 in %t13 as el=%items_el_14, idx=%items_i_15
|
|
24
22
|
%t16 = load_field items_el_14["quantity"] :: integer
|
|
25
|
-
%t18 = call core.gt(%t16,
|
|
23
|
+
%t18 = call core.gt(%t16, 0) :: boolean
|
|
26
24
|
yield %t18
|
|
27
25
|
end_loop
|
|
28
26
|
)
|
|
29
27
|
(Declaration expensive_items
|
|
30
28
|
%t19 = load_input "items" :: array
|
|
31
|
-
%t23 = const 100.0 :: float
|
|
32
29
|
loop items id=L4 in %t19 as el=%items_el_20, idx=%items_i_21
|
|
33
30
|
%t22 = load_field items_el_20["price"] :: float
|
|
34
|
-
%t24 = call core.gt(%t22,
|
|
31
|
+
%t24 = call core.gt(%t22, 100.0) :: boolean
|
|
35
32
|
yield %t24
|
|
36
33
|
end_loop
|
|
37
34
|
)
|
|
38
35
|
(Declaration electronics
|
|
39
36
|
%t25 = load_input "items" :: array
|
|
40
|
-
%t29 = const "electronics" :: string
|
|
41
37
|
loop items id=L5 in %t25 as el=%items_el_26, idx=%items_i_27
|
|
42
38
|
%t28 = load_field items_el_26["category"] :: string
|
|
43
|
-
%t30 = call core.eq(%t28,
|
|
39
|
+
%t30 = call core.eq(%t28, "electronics") :: boolean
|
|
44
40
|
yield %t30
|
|
45
41
|
end_loop
|
|
46
42
|
)
|
|
@@ -13,10 +13,9 @@ export function _subtotals(input) {
|
|
|
13
13
|
export function _discounted_price(input) {
|
|
14
14
|
let out = [];
|
|
15
15
|
let t7 = input["items"];
|
|
16
|
-
const t11 = 0.9;
|
|
17
16
|
t7.forEach((items_el_8, items_i_9) => {
|
|
18
17
|
let t10 = items_el_8["price"];
|
|
19
|
-
let t12 = t10 *
|
|
18
|
+
let t12 = t10 * 0.9;
|
|
20
19
|
out.push(t12);
|
|
21
20
|
});
|
|
22
21
|
return out;
|
|
@@ -25,10 +24,9 @@ export function _discounted_price(input) {
|
|
|
25
24
|
export function _is_valid_quantity(input) {
|
|
26
25
|
let out = [];
|
|
27
26
|
let t13 = input["items"];
|
|
28
|
-
const t17 = 0;
|
|
29
27
|
t13.forEach((items_el_14, items_i_15) => {
|
|
30
28
|
let t16 = items_el_14["quantity"];
|
|
31
|
-
let t18 = t16 >
|
|
29
|
+
let t18 = t16 > 0;
|
|
32
30
|
out.push(t18);
|
|
33
31
|
});
|
|
34
32
|
return out;
|
|
@@ -37,10 +35,9 @@ export function _is_valid_quantity(input) {
|
|
|
37
35
|
export function _expensive_items(input) {
|
|
38
36
|
let out = [];
|
|
39
37
|
let t19 = input["items"];
|
|
40
|
-
const t23 = 100.0;
|
|
41
38
|
t19.forEach((items_el_20, items_i_21) => {
|
|
42
39
|
let t22 = items_el_20["price"];
|
|
43
|
-
let t24 = t22 >
|
|
40
|
+
let t24 = t22 > 100.0;
|
|
44
41
|
out.push(t24);
|
|
45
42
|
});
|
|
46
43
|
return out;
|
|
@@ -49,10 +46,9 @@ export function _expensive_items(input) {
|
|
|
49
46
|
export function _electronics(input) {
|
|
50
47
|
let out = [];
|
|
51
48
|
let t25 = input["items"];
|
|
52
|
-
const t29 = "electronics";
|
|
53
49
|
t25.forEach((items_el_26, items_i_27) => {
|
|
54
50
|
let t28 = items_el_26["category"];
|
|
55
|
-
let t30 = t28 ==
|
|
51
|
+
let t30 = t28 == "electronics";
|
|
56
52
|
out.push(t30);
|
|
57
53
|
});
|
|
58
54
|
return out;
|
|
@@ -1,35 +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 :subtotals then _subtotals
|
|
24
|
-
when :discounted_price then _discounted_price
|
|
25
|
-
when :is_valid_quantity then _is_valid_quantity
|
|
26
|
-
when :expensive_items then _expensive_items
|
|
27
|
-
when :electronics then _electronics
|
|
28
|
-
else raise KeyError, "Unknown declaration"
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def _subtotals(input = @input)
|
|
2
|
+
module Kumi::Compiled::KUMI_290ba22c2167db374abc926a4a20917fbc7211288ee24bcf6eb45f164d318f54
|
|
3
|
+
def self._subtotals(input)
|
|
33
4
|
out = []
|
|
34
5
|
t1 = input["items"] || input[:items]
|
|
35
6
|
t1.each_with_index do |items_el_2, items_i_3|
|
|
@@ -41,49 +12,45 @@ module Kumi::Compiled::KUMI_3d1e29e6240c3a8d445c4a817207b8947c3d74f3a25c3d18b9c7
|
|
|
41
12
|
out
|
|
42
13
|
end
|
|
43
14
|
|
|
44
|
-
def _discounted_price(input
|
|
15
|
+
def self._discounted_price(input)
|
|
45
16
|
out = []
|
|
46
17
|
t7 = input["items"] || input[:items]
|
|
47
|
-
t11 = 0.9
|
|
48
18
|
t7.each_with_index do |items_el_8, items_i_9|
|
|
49
19
|
t10 = items_el_8["price"] || items_el_8[:price]
|
|
50
|
-
t12 = t10 *
|
|
20
|
+
t12 = t10 * 0.9
|
|
51
21
|
out << t12
|
|
52
22
|
end
|
|
53
23
|
out
|
|
54
24
|
end
|
|
55
25
|
|
|
56
|
-
def _is_valid_quantity(input
|
|
26
|
+
def self._is_valid_quantity(input)
|
|
57
27
|
out = []
|
|
58
28
|
t13 = input["items"] || input[:items]
|
|
59
|
-
t17 = 0
|
|
60
29
|
t13.each_with_index do |items_el_14, items_i_15|
|
|
61
30
|
t16 = items_el_14["quantity"] || items_el_14[:quantity]
|
|
62
|
-
t18 = t16 >
|
|
31
|
+
t18 = t16 > 0
|
|
63
32
|
out << t18
|
|
64
33
|
end
|
|
65
34
|
out
|
|
66
35
|
end
|
|
67
36
|
|
|
68
|
-
def _expensive_items(input
|
|
37
|
+
def self._expensive_items(input)
|
|
69
38
|
out = []
|
|
70
39
|
t19 = input["items"] || input[:items]
|
|
71
|
-
t23 = 100.0
|
|
72
40
|
t19.each_with_index do |items_el_20, items_i_21|
|
|
73
41
|
t22 = items_el_20["price"] || items_el_20[:price]
|
|
74
|
-
t24 = t22 >
|
|
42
|
+
t24 = t22 > 100.0
|
|
75
43
|
out << t24
|
|
76
44
|
end
|
|
77
45
|
out
|
|
78
46
|
end
|
|
79
47
|
|
|
80
|
-
def _electronics(input
|
|
48
|
+
def self._electronics(input)
|
|
81
49
|
out = []
|
|
82
50
|
t25 = input["items"] || input[:items]
|
|
83
|
-
t29 = "electronics"
|
|
84
51
|
t25.each_with_index do |items_el_26, items_i_27|
|
|
85
52
|
t28 = items_el_26["category"] || items_el_26[:category]
|
|
86
|
-
t30 = t28 ==
|
|
53
|
+
t30 = t28 == "electronics"
|
|
87
54
|
out << t30
|
|
88
55
|
end
|
|
89
56
|
out
|
|
@@ -1,30 +1,23 @@
|
|
|
1
1
|
(LIR
|
|
2
2
|
(Declaration y_positive
|
|
3
3
|
%t1 = load_input "y" :: integer
|
|
4
|
-
%
|
|
5
|
-
%t3 = call core.gt(%t1, %t2) :: boolean
|
|
4
|
+
%t3 = call core.gt(%t1, 0) :: boolean
|
|
6
5
|
yield %t3
|
|
7
6
|
)
|
|
8
7
|
(Declaration x_positive
|
|
9
8
|
%t4 = load_input "x" :: integer
|
|
10
|
-
%
|
|
11
|
-
%t6 = call core.gt(%t4, %t5) :: boolean
|
|
9
|
+
%t6 = call core.gt(%t4, 0) :: boolean
|
|
12
10
|
yield %t6
|
|
13
11
|
)
|
|
14
12
|
(Declaration status
|
|
15
13
|
%t19 = load_input "y" :: integer
|
|
16
|
-
%
|
|
17
|
-
%t21 = call core.gt(%t19, %t20) :: boolean
|
|
14
|
+
%t21 = call core.gt(%t19, 0) :: boolean
|
|
18
15
|
%t22 = load_input "x" :: integer
|
|
19
|
-
%t24 = call core.gt(%t22,
|
|
16
|
+
%t24 = call core.gt(%t22, 0) :: boolean
|
|
20
17
|
%t9 = call core.and(%t21, %t24) :: boolean
|
|
21
|
-
%
|
|
22
|
-
%
|
|
23
|
-
%
|
|
24
|
-
%t15 = const "neither positive" :: string
|
|
25
|
-
%t16 = select %t21, %t14, %t15 :: string
|
|
26
|
-
%t17 = select %t24, %t12, %t16 :: string
|
|
27
|
-
%t18 = select %t9, %t10, %t17 :: string
|
|
18
|
+
%t16 = select %t21, "y positive", "neither positive" :: string
|
|
19
|
+
%t17 = select %t24, "x positive", %t16 :: string
|
|
20
|
+
%t18 = select %t9, "both positive", %t17 :: string
|
|
28
21
|
yield %t18
|
|
29
22
|
)
|
|
30
23
|
)
|
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
export function _y_positive(input) {
|
|
2
2
|
let t1 = input["y"];
|
|
3
|
-
|
|
4
|
-
let t3 = t1 > t2;
|
|
3
|
+
let t3 = t1 > 0;
|
|
5
4
|
return t3;
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
export function _x_positive(input) {
|
|
9
8
|
let t4 = input["x"];
|
|
10
|
-
|
|
11
|
-
let t6 = t4 > t5;
|
|
9
|
+
let t6 = t4 > 0;
|
|
12
10
|
return t6;
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
export function _status(input) {
|
|
16
14
|
let t19 = input["y"];
|
|
17
|
-
|
|
18
|
-
let t21 = t19 > t20;
|
|
15
|
+
let t21 = t19 > 0;
|
|
19
16
|
let t22 = input["x"];
|
|
20
|
-
let t24 = t22 >
|
|
17
|
+
let t24 = t22 > 0;
|
|
21
18
|
let t9 = t21 && t24;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const t15 = "neither positive";
|
|
26
|
-
let t16 = t21 ? t14 : t15;
|
|
27
|
-
let t17 = t24 ? t12 : t16;
|
|
28
|
-
let t18 = t9 ? t10 : t17;
|
|
19
|
+
let t16 = t21 ? "y positive" : "neither positive";
|
|
20
|
+
let t17 = t24 ? "x positive" : t16;
|
|
21
|
+
let t18 = t9 ? "both positive" : t17;
|
|
29
22
|
return t18;
|
|
30
23
|
}
|
|
31
24
|
|
|
@@ -1,57 +1,23 @@
|
|
|
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 :y_positive then _y_positive
|
|
24
|
-
when :x_positive then _x_positive
|
|
25
|
-
when :status then _status
|
|
26
|
-
else raise KeyError, "Unknown declaration"
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def _y_positive(input = @input)
|
|
2
|
+
module Kumi::Compiled::KUMI_4f7fc8ddac574b096f7f44f6fdba01b5231bfe11da581a23fbbaf72b518172a1
|
|
3
|
+
def self._y_positive(input)
|
|
31
4
|
t1 = input["y"] || input[:y]
|
|
32
|
-
|
|
33
|
-
t1 > t2
|
|
5
|
+
t1 > 0
|
|
34
6
|
end
|
|
35
7
|
|
|
36
|
-
def _x_positive(input
|
|
8
|
+
def self._x_positive(input)
|
|
37
9
|
t4 = input["x"] || input[:x]
|
|
38
|
-
|
|
39
|
-
t4 > t5
|
|
10
|
+
t4 > 0
|
|
40
11
|
end
|
|
41
12
|
|
|
42
|
-
def _status(input
|
|
13
|
+
def self._status(input)
|
|
43
14
|
t19 = input["y"] || input[:y]
|
|
44
|
-
|
|
45
|
-
t21 = t19 > t20
|
|
15
|
+
t21 = t19 > 0
|
|
46
16
|
t22 = input["x"] || input[:x]
|
|
47
|
-
t24 = t22 >
|
|
17
|
+
t24 = t22 > 0
|
|
48
18
|
t9 = t21 && t24
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
t15 = "neither positive"
|
|
53
|
-
t16 = t21 ? t14 : t15
|
|
54
|
-
t17 = t24 ? t12 : t16
|
|
55
|
-
t9 ? t10 : t17
|
|
19
|
+
t16 = t21 ? "y positive" : "neither positive"
|
|
20
|
+
t17 = t24 ? "x positive" : t16
|
|
21
|
+
t9 ? "both positive" : t17
|
|
56
22
|
end
|
|
57
23
|
end
|
|
@@ -14,16 +14,13 @@
|
|
|
14
14
|
)
|
|
15
15
|
(Declaration manager_count
|
|
16
16
|
%t10 = load_input "departments" :: array
|
|
17
|
-
%t18 = const "manager" :: string
|
|
18
|
-
%t20 = const 1 :: integer
|
|
19
|
-
%t21 = const 0 :: integer
|
|
20
17
|
loop departments id=L3 in %t10 as el=%departments_el_11, idx=%departments_i_12
|
|
21
18
|
%acc_13 = decl_acc :: integer
|
|
22
19
|
%t14 = load_field departments_el_11["employees"] :: any
|
|
23
20
|
loop employees id=L4 in %t14 as el=%employees_el_15, idx=%employees_i_16
|
|
24
21
|
%t17 = load_field employees_el_15["role"] :: string
|
|
25
|
-
%t19 = call core.eq(%t17,
|
|
26
|
-
%t22 = select %t19,
|
|
22
|
+
%t19 = call core.eq(%t17, "manager") :: boolean
|
|
23
|
+
%t22 = select %t19, 1, 0 :: integer
|
|
27
24
|
%acc_13 = acc_add agg.sum(%acc_13, %t22) :: integer
|
|
28
25
|
end_loop
|
|
29
26
|
%t23 = acc_load %acc_13 :: integer
|
|
@@ -32,16 +29,13 @@
|
|
|
32
29
|
)
|
|
33
30
|
(Declaration senior_employee_count
|
|
34
31
|
%t24 = load_input "departments" :: array
|
|
35
|
-
%t32 = const "senior" :: string
|
|
36
|
-
%t34 = const 1 :: integer
|
|
37
|
-
%t35 = const 0 :: integer
|
|
38
32
|
loop departments id=L5 in %t24 as el=%departments_el_25, idx=%departments_i_26
|
|
39
33
|
%acc_27 = decl_acc :: integer
|
|
40
34
|
%t28 = load_field departments_el_25["employees"] :: any
|
|
41
35
|
loop employees id=L6 in %t28 as el=%employees_el_29, idx=%employees_i_30
|
|
42
36
|
%t31 = load_field employees_el_29["role"] :: string
|
|
43
|
-
%t33 = call core.eq(%t31,
|
|
44
|
-
%t36 = select %t33,
|
|
37
|
+
%t33 = call core.eq(%t31, "senior") :: boolean
|
|
38
|
+
%t36 = select %t33, 1, 0 :: integer
|
|
45
39
|
%acc_27 = acc_add agg.sum(%acc_27, %t36) :: integer
|
|
46
40
|
end_loop
|
|
47
41
|
%t37 = acc_load %acc_27 :: integer
|
|
@@ -63,10 +57,6 @@
|
|
|
63
57
|
)
|
|
64
58
|
(Declaration department_summary
|
|
65
59
|
%t47 = load_input "departments" :: array
|
|
66
|
-
%t71 = const "manager" :: string
|
|
67
|
-
%t73 = const 1 :: integer
|
|
68
|
-
%t74 = const 0 :: integer
|
|
69
|
-
%t84 = const "senior" :: string
|
|
70
60
|
loop departments id=L9 in %t47 as el=%departments_el_48, idx=%departments_i_49
|
|
71
61
|
%t50 = load_field departments_el_48["name"] :: string
|
|
72
62
|
%acc58 = decl_acc :: integer
|
|
@@ -78,12 +68,12 @@
|
|
|
78
68
|
%t62 = load_field t60["salary"] :: integer
|
|
79
69
|
%acc58 = acc_add agg.sum(%acc58, %t62) :: integer
|
|
80
70
|
%t70 = load_field t60["role"] :: string
|
|
81
|
-
%t72 = call core.eq(%t70,
|
|
82
|
-
%t75 = select %t72,
|
|
71
|
+
%t72 = call core.eq(%t70, "manager") :: boolean
|
|
72
|
+
%t75 = select %t72, 1, 0 :: integer
|
|
83
73
|
%acc66 = acc_add agg.sum(%acc66, %t75) :: integer
|
|
84
74
|
%acc92 = acc_add agg.max(%acc92, %t62) :: integer
|
|
85
|
-
%t85 = call core.eq(%t70,
|
|
86
|
-
%t88 = select %t85,
|
|
75
|
+
%t85 = call core.eq(%t70, "senior") :: boolean
|
|
76
|
+
%t88 = select %t85, 1, 0 :: integer
|
|
87
77
|
%acc79 = acc_add agg.sum(%acc79, %t88) :: integer
|
|
88
78
|
end_loop
|
|
89
79
|
%t63 = acc_load %acc58 :: integer
|
|
@@ -16,16 +16,13 @@ export function _total_payroll(input) {
|
|
|
16
16
|
export function _manager_count(input) {
|
|
17
17
|
let out = [];
|
|
18
18
|
let t10 = input["departments"];
|
|
19
|
-
const t18 = "manager";
|
|
20
|
-
const t20 = 1;
|
|
21
|
-
const t21 = 0;
|
|
22
19
|
t10.forEach((departments_el_11, departments_i_12) => {
|
|
23
20
|
let acc_13 = 0;
|
|
24
21
|
let t14 = departments_el_11["employees"];
|
|
25
22
|
t14.forEach((employees_el_15, employees_i_16) => {
|
|
26
23
|
let t17 = employees_el_15["role"];
|
|
27
|
-
let t19 = t17 ==
|
|
28
|
-
let t22 = t19 ?
|
|
24
|
+
let t19 = t17 == "manager";
|
|
25
|
+
let t22 = t19 ? 1 : 0;
|
|
29
26
|
acc_13 += t22;
|
|
30
27
|
});
|
|
31
28
|
out.push(acc_13);
|
|
@@ -36,16 +33,13 @@ export function _manager_count(input) {
|
|
|
36
33
|
export function _senior_employee_count(input) {
|
|
37
34
|
let out = [];
|
|
38
35
|
let t24 = input["departments"];
|
|
39
|
-
const t32 = "senior";
|
|
40
|
-
const t34 = 1;
|
|
41
|
-
const t35 = 0;
|
|
42
36
|
t24.forEach((departments_el_25, departments_i_26) => {
|
|
43
37
|
let acc_27 = 0;
|
|
44
38
|
let t28 = departments_el_25["employees"];
|
|
45
39
|
t28.forEach((employees_el_29, employees_i_30) => {
|
|
46
40
|
let t31 = employees_el_29["role"];
|
|
47
|
-
let t33 = t31 ==
|
|
48
|
-
let t36 = t33 ?
|
|
41
|
+
let t33 = t31 == "senior";
|
|
42
|
+
let t36 = t33 ? 1 : 0;
|
|
49
43
|
acc_27 += t36;
|
|
50
44
|
});
|
|
51
45
|
out.push(acc_27);
|
|
@@ -75,10 +69,6 @@ export function _max_salary(input) {
|
|
|
75
69
|
export function _department_summary(input) {
|
|
76
70
|
let out = [];
|
|
77
71
|
let t47 = input["departments"];
|
|
78
|
-
const t71 = "manager";
|
|
79
|
-
const t73 = 1;
|
|
80
|
-
const t74 = 0;
|
|
81
|
-
const t84 = "senior";
|
|
82
72
|
t47.forEach((departments_el_48, departments_i_49) => {
|
|
83
73
|
let t50 = departments_el_48["name"];
|
|
84
74
|
let acc58 = 0;
|
|
@@ -90,16 +80,16 @@ export function _department_summary(input) {
|
|
|
90
80
|
let t62 = t60["salary"];
|
|
91
81
|
acc58 += t62;
|
|
92
82
|
let t70 = t60["role"];
|
|
93
|
-
let t72 = t70 ==
|
|
94
|
-
let t75 = t72 ?
|
|
83
|
+
let t72 = t70 == "manager";
|
|
84
|
+
let t75 = t72 ? 1 : 0;
|
|
95
85
|
acc66 += t75;
|
|
96
86
|
if (acc92 === null || acc92 === undefined) {
|
|
97
87
|
acc92 = t62;
|
|
98
88
|
} else {
|
|
99
89
|
acc92 = (acc92 === null || t62 > acc92) ? t62 : acc92;
|
|
100
90
|
}
|
|
101
|
-
let t85 = t70 ==
|
|
102
|
-
let t88 = t85 ?
|
|
91
|
+
let t85 = t70 == "senior";
|
|
92
|
+
let t88 = t85 ? 1 : 0;
|
|
103
93
|
acc79 += t88;
|
|
104
94
|
});
|
|
105
95
|
let t55 = {
|