2 ms·
I agree, which is better - for or map - depends on context. map typically is functional and allocates memory, for does not. But for is more likely to have side-
by kagevf 2y ago
I agree, which is better - for or map - depends on context. map typically is functional and allocates memory, for does not. But for is more likely to have side-effects. Which trade-offs matter depends on the larger context of the surrounding code.
- CRConrad 2y ago> map typically is functional and allocates memory, for does not. But for is more likely to have side-effects. If / when memory is low, allocating memory can itself be a side-effect...