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

proposal: slices: Add higher-order functions on slices (map, filter, fold, etc.) #71518

Closed
Aditya-Singhvi opened this issue Jan 31, 2025 · 2 comments
Labels
Milestone

Comments

@Aditya-Singhvi
Copy link

Proposal Details

I propose adding higher-order functions like Map, Filter, Fold, etc. to the slices library. These higher-order functions make writing data transforms far more ergonomic. They are present in other languages.

I believe this library already implements some version of these: https://pkg.go.dev/github.com/sa-/slicefunk. I think it would be nice for these to be integrated into the standard slices library.

I'm pretty new to Go -- if there's a good language reason for not including these, I'd love to learn more about why!

@gopherbot gopherbot added this to the Proposal milestone Jan 31, 2025
@randall77
Copy link
Contributor

The plan is to have such functions operate on iterators, not just slices.
See #61898
I'm going to close, as I think that issue subsumes this one. Please reopen if you disagree.

@Aditya-Singhvi
Copy link
Author

Cool, thanks! Didn't see that one while I was browsing the issues -- I agree that it definitely subsumes this one.

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

No branches or pull requests

3 participants