It turns out that loop inputs are unnecessary, and we can just use Let. So this rule removes inputs from loops. For the first iteration, the argument in the loop refer to the argument outside the loop.
For example, the following loop:
(Loop (Id 1)
(Add (Num 1) (Num 2))
some_loop_body)
Can be expressed as
(Let (Id 2)
(Add (Num 1) (Num 2))
(Loop (Id 1) some_loop_body))
It turns out that loop inputs are unnecessary, and we can just use
Let
. So this rule removes inputs from loops. For the first iteration, the argument in the loop refer to the argument outside the loop.For example, the following loop:
Can be expressed as
In general, the following rule holds: