3 ms·
Why the for loop instead of mapping the enumerate iterator into Block::new and collect::Vec?
by maleldil 2y ago
Why the for loop instead of mapping the enumerate iterator into Block::new and collect::Vec?
- aquariusDue 2y agoI lack a good answer other than it didn't occur to me, now I have some code to refactor. Thanks!
- maleldil 2y agoFWIW, I've had to write similar code when there's some complex "folding" operation. I use map/filter a lot, but fold/reduce/accumulate always seemed harder to understand than a for loop. I also prefer nested loops rather than nested iterators.