Idiomatic Rust favors Functional or Imperative Style?

rubberduck203,

Yes please.

This craze for "functional" style makes me crazy. That stackexchange link demonstrates it nicely. The op there has a perfectly fine, simple loop with the expected divides and modulos in it. Clear as a bell. Then comes the "functional" version, which gets to_digit() to do all the work and then wraps it all up in a mess of .chars()....filter()...map()...collect().

Why for goodess sake?

And see what a mess this recent poster here gets into solving a simple problem: Can this code be any simpler?

2 Likes