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

Add Iterable.intersperse extension method #309

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

Conversation

ebraminio
Copy link
Contributor

@ebraminio ebraminio commented Aug 20, 2023

I needed something that could add an element between each two elements in a list as I just hardcoded that functionality in my flutter app but now have decided to revise that code so did some research about it as I didn't even know what name that has and eventually reached to https://github.com/apple/swift-algorithms/blob/main/Guides/Intersperse.md which itself is linked to https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-List.html#v:intersperse and https://docs.rs/itertools/0.9.0/itertools/trait.Itertools.html#method.intersperse which felt that makes it enough popular to be added to collection. It would be ok also if you would like to rename this to something better.

Or maybe we should have two of them, intersperse that mutates a list and interspersed, the one who returns a new iterator, or maybe we should provide only one and should be named interspersed like swift or we should follow rust and Haskell instead.

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.

None yet

1 participant