November 2017
Intermediate to advanced
670 pages
17h 35m
English
The Filter function is a HOF that takes another HOF, namely ByMake, and performs a data transformation.
func (cars Collection) Filter(fn FilterFunc) Collection { filteredCars := make(Collection, 0) for _, car := range cars { if fn(car) { filteredCars = append(filteredCars, car) } } return filteredCars}