Map should use same order of arguments as pythons map

This commit is contained in:
Kovid Goyal
2023-03-05 12:19:03 +05:30
parent e6d53a1921
commit c88a171b28
2 changed files with 2 additions and 2 deletions

View File

@@ -57,7 +57,7 @@ func Filter[T any](s []T, f func(x T) bool) []T {
return ans
}
func Map[T any](s []T, f func(x T) T) []T {
func Map[T any](f func(x T) T, s []T) []T {
ans := make([]T, 0, len(s))
for _, x := range s {
ans = append(ans, f(x))