This commit is contained in:
ArkBriar
2015-11-06 12:34:06 +08:00
parent 00f43b0519
commit 3327c5a1c6

View File

@@ -74,7 +74,7 @@ allNewBMWs := allCars.FindAll(func(car *Car) bool {
4我们也可以根据入参返回不同的函数。也许我们想根据不同的厂商添加汽车到不同的集合但是这可能会是多变的。所以我们可以定义一个函数来产生特定的添加函数和 map 集: 4我们也可以根据入参返回不同的函数。也许我们想根据不同的厂商添加汽车到不同的集合但是这可能会是多变的。所以我们可以定义一个函数来产生特定的添加函数和 map 集:
```go ```go
funcMakeSortedAppender(manufacturers[]string)(func(car*Car),map[string]Cars) { func MakeSortedAppender(manufacturers[]string)(func(car*Car),map[string]Cars) {
// Prepare maps of sorted cars. // Prepare maps of sorted cars.
sortedCars := make(map[string]Cars) sortedCars := make(map[string]Cars)
for _, m := range manufacturers { for _, m := range manufacturers {