OK, how about this...? (Maybe I actually understood something.)
I was thinking lately about "map" methods (take in a list, and output a list where some operation has been performed on every element).
That's a perfect case here, because the list operations (iteration and concatenation) are always the same, but the operation is different.
Here's what I came up with (and also added an analog to SC's Array.fill(n, { ... func ... })
).
... where the top right example prints "50 30 90 80 20 60". Unpack is because (inspired here by SC's do
and collect
) it may be useful to pass an index through.
This seems to work pretty well actually. As noted earlier in the thread, it's the user's responsibility to avoid name collision, but apart from that, this seems to fill a gap.
hjh