2
// Filter returns a new slice holding only
// the elements of s that satisfy f()
func Filter(s []int, fn func(int) bool) []int {
var p []int // == nil
for _, v := range s {
if fn(v) {
p = append(p, v)
}
}
return p
}
我沒有我的想法如何使用此功能,任何幫助,將不勝感激。Golang博客片和內部
幫我,我有點糊塗了。 – location