4 ms·
Thanks for noting, but my bigger concern was with different thing, that I’m also quoting from the doc (https://go2goplay.golang.org/p/LFo23rCKHXZ https://go2gop
by galkk 6y ago
Thanks for noting, but my bigger concern was with different thing, that I’m also quoting from the doc (https://go2goplay.golang.org/p/LFo23rCKHXZ https://go2goplay.golang.org/p/LFo23rCKHXZ):
func Filter(type T)(s []T, f func(T) bool) []T { ... }
s:= []int{1,2m3}
evens := slices.Filter(s, func(i int) bool { return i%2 == 0 })
The type of predicate is already in generic definition, we don’t need this verbosity. Other languages (I’d even say most of languages, used in dev work today) let us write simply something like slices.Filter(s, i->i%2).