loading...

re: Learning Rust via the Advent Of Code - Part 1 VIEW POST

FULL DISCUSSION
 

Why don't you call sum() immediately after map()? This way you wouldn't need the v vector.

 

That's true, I could have done it. I just adapted the choice from the possibilities docs and along the way I learnt about the iter() and collect() :)

 

Could avoid allocating the temp vec by doing a fold left, even

Code of Conduct Report abuse