Map takes a transforming function and a list, and transforms each element.
type MyString string
func NewMyString(s string) MyString{return MyString(s)}
a := []string{"A", "B", "C"}
If you want to create a []MyString from []string, now you have to loop over that and transform by hand, with generics you could do map(NewMyString, a).
Map takes a transforming function and a list, and transforms each element.
type MyString string
func NewMyString(s string) MyString{return MyString(s)}
a := []string{"A", "B", "C"}
If you want to create a []MyString from []string, now you have to loop over that and transform by hand, with generics you could do map(NewMyString, a).