4 ms·
They're both pretty clear but I'd prefer the second one (if you used collect instead of fold)
by conradludgate 5y ago
They're both pretty clear but I'd prefer the second one (if you used collect instead of fold)
- Kinrany 5y agoI chose Rust syntax because it allows both chaining and using methods as functions, but avoided Rust-specific features. In addition to `collect` this example is missing `.into_iter()` that both examples would need: I interpreted `apples` as an iterator instead. Otherwise the first example would be clearer with a for loop.