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

[Feature Request] add Iter::flatten #1497

Open
illusory0x0 opened this issue Jan 16, 2025 · 1 comment
Open

[Feature Request] add Iter::flatten #1497

illusory0x0 opened this issue Jan 16, 2025 · 1 comment

Comments

@illusory0x0
Copy link
Contributor

here is a possible implentation

pub fn Iter::flatten[T](self : Iter[Iter[T]]) -> Iter[T] {
  self.flat_map(fn(x) {x})
}
@illusory0x0
Copy link
Contributor Author

similar issue, user might write many boilplate code.

How to organize the "duplicate" code?

To eliminate duplicate code, this is why we need generic programming

If abstraction doesn't sacrifice performance, I think it needs to be abstracted

related issues:

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

1 participant