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

Differences in Base.Iterators.map and IterTools.imap #123

Open
PatrickHaecker opened this issue Feb 16, 2025 · 3 comments
Open

Differences in Base.Iterators.map and IterTools.imap #123

PatrickHaecker opened this issue Feb 16, 2025 · 3 comments

Comments

@PatrickHaecker
Copy link
Contributor

We should document the difference between Base.Iterators.map and IterTools.imap or document that there is no difference.

I think that there is no difference, but I am not certain that

map(f, arg, args...) = Base.Generator(f, arg, args...)

and

imap(mapfunc, it1, its...) = (mapfunc(xs...) for xs in zip(it1, its...))

always will behave identical. Both create a Base.Generator and I think the zip does not change here anything as Generator is also using zip:

Generator(f, I1, I2, Is...) = Generator(a->f(a...), zip(I1, I2, Is...))

Can someone confirm, that they are identical, so that we can create a PR to document it?

@oxinabox
Copy link
Member

They are identical and we should delete ours.
it is just that this is older than that being in Base.Iterators

@PatrickHaecker
Copy link
Contributor Author

Would you prefer doing this yourself or getting a PR?
I am hesitant, as this PR would imply a SemVer version update. Would this update be included in the PR? I can't promise that I'll find the time, but it probably does not hurt to document the preferred way.

@omus
Copy link
Contributor

omus commented Feb 18, 2025

I was going to suggest adding Iterators.map to Compat.jl but Iterators.map has existed since Julia 1.6 so it doesn't seem worth it

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

No branches or pull requests

3 participants