Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zip overload which returns sequence of tuples #558

Open
voxoid0 opened this issue Feb 5, 2019 · 6 comments
Open

Zip overload which returns sequence of tuples #558

voxoid0 opened this issue Feb 5, 2019 · 6 comments

Comments

@voxoid0
Copy link

voxoid0 commented Feb 5, 2019

It would be very convenient, esp in the context of the functional programming paradigm (which thanks to MoreLinq is much more attainable in C#!), to have kind of a "default" Zip() that returns tuples of the two zipped collections. Right now we always have to provide function like (x1, x2) => (x1, x2), which, if we accept tuples as first-class citizens, seems repetitive and adds clutter to the code.

@atifaziz atifaziz changed the title Zip() overload which requires no function and returns tuples IEnumerable<(T1, T2)> Zip overload which returns sequence of tuples Feb 9, 2019
@atifaziz
Copy link
Member

atifaziz commented Feb 9, 2019

This is a good idea and something I've been wanting to do for some time. Is it something you would like to help with?

Meanwhile, you don't have spell out the whole lambda like (x1, x2) => (x1, x2). You can just get away with supplying the ValueTuple.Create method group, as in xs.Zip(ys, ValueTuple.Create).

@voxoid0
Copy link
Author

voxoid0 commented Mar 23, 2019

Sorry for the delay. Yes I'd be glad to help with that; will create a pull request when I get the chance.

@atifaziz
Copy link
Member

atifaziz commented Apr 4, 2019

This comment is just a note that while the same was done for Enumerable.Zip in the CoreFX repo, it was later reverted due to strong differences in opinions about the naming convention that applies to tuple element names. Until such differences are reconciled, it seems that tuples will not be exposed in any CoreFX API any time soon.

Good thing we never debated that too hard, 😅went with Pascal casing and haven't looked back.

@Orace
Copy link
Contributor

Orace commented Nov 5, 2019

Addressed in zip refactoring #639 and in #598

@atifaziz
Copy link
Member

atifaziz commented Nov 5, 2019

Fixed in #639

Correction: this is being addressed in PR #598. It is not fixed unless a PR is merged into the master branch and neither PR #598 nor PR #639 have been merged. I felt compelled to drop this note so anyone reading “fixed” doesn't build up the wrong expectation. That said, I hope to get to the bottom of this thanks to a lot of your help in the area.

@atifaziz atifaziz removed the good first issue Good for newcomers label Nov 5, 2019
@Orace
Copy link
Contributor

Orace commented Nov 5, 2019

Fixed in #639

Correction: this is being addressed in PR #598. It is not fixed unless a PR is merged into the master branch and neither PR #598 nor PR #639 have been merged. I felt compelled to drop this note so anyone reading “fixed” doesn't build up the wrong expectation. That said, I hope to get to the bottom of this thanks to a lot of your help in the area.

Sorry about that, I will try to be careful about what I wrote.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants