2023-10-31 05:09:29 +00:00
|
|
|
==================
|
2023-10-31 07:17:58 +00:00
|
|
|
Simple Reduce Loop
|
2023-10-31 05:09:29 +00:00
|
|
|
==================
|
|
|
|
|
|
|
|
reduce i to acc in [1, 2, 3] {
|
|
|
|
acc += i
|
|
|
|
}
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
(root
|
2023-10-31 13:31:10 +00:00
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(reduce
|
|
|
|
(identifier)
|
|
|
|
(identifier)
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(list
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer))))))
|
|
|
|
(block
|
2023-10-31 05:09:29 +00:00
|
|
|
(statement
|
2023-10-31 13:31:10 +00:00
|
|
|
(assignment
|
|
|
|
(identifier)
|
|
|
|
(assignment_operator)
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(identifier))))))))))
|
2023-10-31 05:09:29 +00:00
|
|
|
|
|
|
|
==================
|
2023-10-31 07:17:58 +00:00
|
|
|
Nested Reduce Loop
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
(root
|
2023-10-31 13:31:10 +00:00
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(reduce
|
|
|
|
(identifier)
|
|
|
|
(identifier)
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(list
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string)))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string)))
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string))))))
|
|
|
|
(block
|
2023-10-31 07:17:58 +00:00
|
|
|
(statement
|
2023-10-31 13:31:10 +00:00
|
|
|
(assignment
|
|
|
|
(identifier)
|
|
|
|
(assignment_operator)
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(identifier))))))))))
|