[Pre-RFC] Replace IteratorExt::zip with tuple iteration


#21

I prefer the explicit versions like (a, b, c).zip() or Zip::new((a, b, c)) too.


#22

Yeah, there are at least four ways to interpret (a, b, c).into_iter():

  1. Zip the iterators (original proposal)
  2. Chain the iterators
  3. Cartesian product (@glaebhoerl, Haskell)
  4. Treat the tuple as a slice (@DanielKeep, Python)

Without context, it won’t be obvious which of these is being used.


#23

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.


#24

:+1: but to have it possible in sane way we need variadic templates.


#25

since this has been delegated to post-1.0 we can wait for variadic generics :slight_smile: