Thank you very much for your thoughts! I only ‘found’ the ‘Iterator over Results -> collect into a Result’ feature by banging my head against the compiler for a while! Google, however, came to the rescue, and I saw it in some code and thought, “oh neat!”.
I wondered about using a
? just on the digits.
Performance-wise, I did benchmark it; the harder-to-read mutable/imperative type is about 50% faster than the functional one, but that might be solely because the functional one constructs a second list, whereas the other just iterates over
digits; I’ve blogged about it here which I hope it’s not a faux pas in blogging and asking the question here.