校对11.14

This commit is contained in:
dake
2015-11-02 23:47:44 +08:00
parent cbdb2d70ce
commit 7ca34089ef

View File

@@ -15,7 +15,7 @@ type Cars []*Car
```
我们可以用函数定义所需的功能有争议的事实来使用高阶函数,例如:
在定义所需功能时我们可以用函数可以作为(其它函数的)参数的事实来使用高阶函数,例如:
1定义一个通用的 `Process()` 函数,它接收一个作用于每一辆 car 的 f 函数作参数:
@@ -46,7 +46,7 @@ func (cs Cars) FindAll(f func(car *Car) bool) Cars {
```
3实现一个 Map 功能,产出除 car 对象以外的东西:
3实现 Map 功能,产出除 car 对象以外的东西:
```go
// Process cars and create new data.
@@ -95,7 +95,7 @@ funcMakeSortedAppender(manufacturers[]string)(func(car*Car),map[string]Cars) {
```
现在我们可以用它把汽车分为独立的集合,像这样:
现在我们可以用它把汽车分为独立的集合,像这样:
```go
manufacturers := []string{Ford, Aston Martin, Land Rover, BMW, Jaguar}
@@ -105,7 +105,7 @@ BMWCount := len(sortedCars[“BMW”])
```
我们让这些代码在下面的程序 cars.go只展示了 main() 中的代码,别的代码已经在上面展示)中执行:
我们让这些代码在下面的程序 cars.go只展示了 main() 中的代码,别的代码已经在上面展示)中执行:
示例 11.18 [cars.go](examples/chapter_11/cars.go)