I've decided, for the sake of insanity, to work my way through the O'Reilly Programming Rust book, since I feel like my Rust has become, shall we say, rusty. And I'm doing it with my usual sense of attitude, that "There has to be a better way!"

First, I took this mess from the very first example (another greatest common denominator function... you'd think tutorial writers would figure out most of us would rather write something useful, ne):

<code>let mut numbers == Vec::new();
for arg in std::env::args().skip(1) {
                     .expect('error parsing argument'));

And said, "I know there are way to initialize and map values automatically in other languages. Rust should too." And I dug through the documentation and discovered, why yes, Rust does:

<code>let numbers = Vec::from_iter(
        .map(|x| u64::from_str(&x).expect("Error parsing argument")));</code>

That's pretty dense, but it does the job, and it uses the exact same allocations, too.

The next step was the actual reduction (I'd already written the GCD function in a library):

<code>let mut d = numbers[0];
for m in &numbers[1..] {
    d = gcd(d, *m);

Could I one-liner that? Why yes:

<code>    let d = &numbers[1..].iter().fold(numbers[0], |acc, x| gcd(acc, *x));</code>

I know there are people who hate this kind of programming, but I dunno, I find it much more readable. It says that d is a reduction via GCD of all the numbers in a container. It's actually less confusing than the loop.

To me, at least.