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_squash & zip_stretch #1004

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JonathanWoollett-Light
Copy link

@JonathanWoollett-Light JonathanWoollett-Light commented Dec 14, 2024

Introduces new zip alternatives.

I was making an application that uses something like zip_squash and thought it could be implemented here.

Examples might be forming pairs from 2 sets of data where you want one-to-one relationships with zip_squash or sets where you want all points to have a pair and want many-to-one relationships with zip_stretch.

src/lib.rs Outdated
Comment on lines 4565 to 4569
fn zip_squash<J>(self, other: J) -> ZipSquash<Self, J::IntoIter>
where
J: IntoIterator,
<J as IntoIterator>::IntoIter: ExactSizeIterator,
Self: Sized;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this method just be on Itertools with a Self: ExactSizeIterator bound? Why introduce a new trait?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah I can do that. Updated to do that.

@JonathanWoollett-Light JonathanWoollett-Light force-pushed the ExactSizeItertools branch 2 times, most recently from 1130e46 to fe3c505 Compare December 14, 2024 07:16
@JonathanWoollett-Light JonathanWoollett-Light changed the title Proposal: ExactSizeItertools zip_squash & zip_stretch Dec 14, 2024
@JonathanWoollett-Light JonathanWoollett-Light force-pushed the ExactSizeItertools branch 2 times, most recently from 5e80e7c to 0e2f859 Compare December 15, 2024 03:59
Introduces new zip alternatives.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants