Oh, this discussion gave me another idea for a name, init:
for init(sum = 0), x <- [1, 2, 3] do
{x * 2, sum + x}
end
The goal is to initialize variables to be used as state during the for. All variables initialized as part of the for must then be returned inside do-end block.
It may be slightly confusing in cases like this:
sum = 0
for init(sum), x <- [1, 2, 3] do
{x * 2, sum + x}
end
But we can argue it is a shortcut for init(sum = sum).
I don’t want to overreact but this may be my favorite option so far. ![]()






















