Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  > (except the obvious `:Vec<_>` type that is not required)
It is required, otherwise, `collect()` doesn't know what type of collection to collect into.

  > It may be possible to implement `.zipped` on tuples though.
This is impossible without varargs, no?


> This is impossible without varargs, no?

Nah, you'd just implement it as an impl over and over on tuples of reasonable size (up to 16 or so).

It wouldn't be elegant, but it'd work in practice.



Oh right, I see now.



> `collect()` doesn't know what type of collection to collect into.

Yes, unless there is some other mention of Vec, i.e. it is returned from the function.

> This is impossible without varargs, no?

Varargs would definitely help, and would allow Rust to borrow more ideas without workarounds. But one can do it manually for each tuple variant.


Haskell just brute force implements zipWith3, zipWith4 etc

Not elegant, but it works.


The un brute force way is to use the Applicative instance of ZipList.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: