2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2023-10-31 07:17:58 +00:00
|
|
|
Simple Reduce Loop
|
2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2023-10-31 05:09:29 +00:00
|
|
|
|
|
|
|
reduce i to acc in [1, 2, 3] {
|
|
|
|
acc += i
|
|
|
|
}
|
|
|
|
|
2023-11-11 01:44:03 +00:00
|
|
|
--------------------------------------------------------------------------------
|
2023-10-31 05:09:29 +00:00
|
|
|
|
|
|
|
(root
|
2023-11-11 01:44:03 +00:00
|
|
|
(statement
|
|
|
|
(reduce
|
|
|
|
(identifier)
|
|
|
|
(identifier)
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(list
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer))))))
|
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(assignment
|
|
|
|
(identifier)
|
|
|
|
(assignment_operator)
|
|
|
|
(statement
|
2023-10-31 13:31:10 +00:00
|
|
|
(expression
|
2023-11-11 01:44:03 +00:00
|
|
|
(identifier)))))))))
|
2023-10-31 05:09:29 +00:00
|
|
|
|
2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2023-10-31 07:17:58 +00:00
|
|
|
Nested Reduce Loop
|
2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2023-10-31 05:09:29 +00:00
|
|
|
|
2023-10-31 07:17:58 +00:00
|
|
|
reduce i to acc in ["one", "two", "three"] {
|
2023-10-31 05:09:29 +00:00
|
|
|
acc += i
|
|
|
|
}
|
|
|
|
|
2023-11-11 01:44:03 +00:00
|
|
|
--------------------------------------------------------------------------------
|
2023-10-31 05:09:29 +00:00
|
|
|
|
|
|
|
(root
|
2023-11-11 01:44:03 +00:00
|
|
|
(statement
|
|
|
|
(reduce
|
|
|
|
(identifier)
|
|
|
|
(identifier)
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(list
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string)))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string)))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string))))))
|
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(assignment
|
|
|
|
(identifier)
|
|
|
|
(assignment_operator)
|
|
|
|
(statement
|
2023-10-31 13:31:10 +00:00
|
|
|
(expression
|
2023-11-11 01:44:03 +00:00
|
|
|
(identifier)))))))))
|