Playing with 1.18 I've noticed that I can immediately replace pretty much 
all uses of https://github.com/thoas/go-funk with the new slices package. 

One common use case that I happen to have in the codebase quite a lot is 
extracting data from a slice of objects:

funk.Map(chargers, func(c easee.Charger) string { return c.ID })

I feel it would be nice to add something like that as part of slices:

func Map[From, To any](s []From, f func(From) To) []To {
res := make([]To, len(s))
for i, v := range s {
res[i] = f(v)
}
return res
}

Has this already been discussed?

Thanks,
Andi

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/73289ac6-788e-42d4-85e9-00486a970c21n%40googlegroups.com.

Reply via email to