We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I propose the following:
func Transform[S ~[]E, E any, T any](sl S, f func(E) T) []T { out := make([]T, len(sl)) for i, t := range sl { out[i] = f(t) } return out }
Something similar to the method from JS: map.
Using this code, you:
type user struct { id int64 } users := make([]user, 0) ... sendByIDs(slices.Transform(users, func(u user) int64 { return u.id }))
I believe that the name "map" could be confusing and may be associated with the type.
The text was updated successfully, but these errors were encountered:
Duplicate of #58881
Sorry, something went wrong.
Map
Filter
No branches or pull requests
Proposal Details
Proposal Details
I propose the following:
Something similar to the method from JS: map.
Using this code, you:
Sample code:
Naming
I believe that the name "map" could be confusing and may be associated with the type.
The text was updated successfully, but these errors were encountered: