4 ms·
And yet, a Rust Option (or really any option) can just be viewed as a list of one or zero elements. https://rust-unofficial.github.io/patterns/idioms/option-ite
by vladf 3y ago
And yet, a Rust Option (or really any option) can just be viewed as a list of one or zero elements. https://rust-unofficial.github.io/patterns/idioms/option-iter.html https://rust-unofficial.github.io/patterns/idioms/option-ite...
In fact, in Haskell, operating on an option conditionally has the exact same functor as a list: `map`.
So what am I to do, with an iterator? It's conflicting advice! An if is a for for an option.