3 ms·
The author's fold example is unfair. They could've just called accumulator.extend() and then return the accumulator inside the fold example for a fair apple to
by kccqzy 2y ago
The author's fold example is unfair. They could've just called accumulator.extend() and then return the accumulator inside the fold example for a fair apple to apple comparison. Just mark the accumulator as mut.
Furthermore, I'd use with_capacity in both cases: Vec::with_capacity(list_of_lists.iter().map(|l| l.len()).sum())