From c88a171b289889aa92370e28d06db5e0dd93832d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 5 Mar 2023 12:19:03 +0530 Subject: [PATCH] Map should use same order of arguments as pythons map --- tools/themes/collection.go | 2 +- tools/utils/misc.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/themes/collection.go b/tools/themes/collection.go index dd1f45d7e..9bf46264d 100644 --- a/tools/themes/collection.go +++ b/tools/themes/collection.go @@ -327,7 +327,7 @@ func theme_name_from_file_name(fname string) string { fname = fname[:len(fname)-len(path.Ext(fname))] fname = strings.ReplaceAll(fname, "_", " ") fname = camel_case_pat().ReplaceAllString(fname, "$1 $2") - return strings.Join(utils.Map(strings.Split(fname, " "), strings.Title), " ") + return strings.Join(utils.Map(strings.Title, strings.Split(fname, " ")), " ") } func (self *Themes) AddFromFile(path string) (*Theme, error) { diff --git a/tools/utils/misc.go b/tools/utils/misc.go index b63250f05..39a0d56d4 100644 --- a/tools/utils/misc.go +++ b/tools/utils/misc.go @@ -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))