3 ms·
> for-in doesn't tell you the index of the current object so you'd have to manually keep track of the index. Functional decoration trivially provides that. Jus
by masklinn 11y ago
> for-in doesn't tell you the index of the current object so you'd have to manually keep track of the index.
Functional decoration trivially provides that. Just zip a counter with the backing iterable, and modern languages generally provide that OOTB as a variant of `enumerate()` e.g.
for i, item in it.enumerate():
# stuff
> Also, x++ is a common syntax in many languages
Meh. It's generally present in B derivatives (via C) and that's pretty much it. Most languages do just fine without it.
- deleted 11y ago[deleted]