3 ms·
I don't find this at all unexpected. In an imperative language I expect a loop to be implemented by mutating a common variable.
by edflsafoiewq 7y ago
I don't find this at all unexpected. In an imperative language I expect a loop to be implemented by mutating a common variable.
- jakear 7y agoDo you perhaps think that because you come from a background in low-level languages?
- deleted 7y ago[deleted]
- owl57 7y agoImperative loop, maybe. But list comprehensions are a sublanguage imported from Haskell and looking like Haskell, so it's somewhat natural to be surprised by mutable variables here.
- deleted 7y ago[deleted]
- deleted 7y ago[deleted]
- fanf2 7y agoLua and Perl use fresh variables for each iteration, instead of mutating a shared copy.