rust-itertools / itertools

Extra iterator adaptors, iterator methods, free functions, and macros.
https://docs.rs/itertools/
Apache License 2.0
2.62k stars 298 forks source link

`maybe_` for `cmp`, `partial_cmp`, `eq`, `ne`, `lt`, `le`, `gt`, `ge` #952

Closed Xenira closed 1 month ago

Xenira commented 1 month ago

Grouped this together, as those methods all take a second iterator (or IntoIterator to be precise) with Ord item as argument.

Having results would require something like this (if that even works, did not test yet):

iter.process_results(
     |iter| other.process_results(|other| iter.ge(other))
)??,

Having maybe_ methods would make this way less verbose and the intent clearer.

Related to #844 and label GitHub labels

Philippe-Cholet commented 1 month ago

I personally don't know where those cmp & Co. methods are used. I never did myself (but I'm no veteran). So I don't know if there is a need for 8 maybe_ methods, especially when no one asked (AFAIK) for cmp_ok or related (we have a few _ok methods).

Xenira commented 1 month ago

Don't have a concrete usecase as well. Kind wanted to support it as a lib function. Can be closed until someone has a real usecase.