I prefer the explicit versions like (a, b, c).zip()
or Zip::new((a, b, c))
too.
2 Likes
Yeah, there are at least four ways to interpret (a, b, c).into_iter()
:
- Zip the iterators (original proposal)
- Chain the iterators
- Cartesian product (@glaebhoerl, Haskell)
- Treat the tuple as a slice (@DanielKeep, Python)
Without context, it won't be obvious which of these is being used.
tuple as slice won’t make sense if the type of the tuple elements differs, and would then make sense for all types (even those that don’t implement Iterator
.
I now agree that there should be a TupleIterExt that offers .zip()
and .prod()
for all tuples of types implementing Iterator
.
.chain()
is special, as it can only exist if the iterators have the same Item
type.
but to have it possible in sane way we need variadic templates.
since this has been delegated to post-1.0 we can wait for variadic generics
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.