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
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 2 deletions

View File

@ -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) {

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))