Go Mapreduce
原文链接: Go Mapreduce
func Map(f func (int) int, v []int) (r []int) {
r = make([]int, len(v))
for i, value := range v {
r[i] = f(value)
}
return
}
func main () {
v := []int{1, 2, 3, 4}
fmt.Println(Map(func(x int) int {return x * 5}, v ))
}