November 2017
Intermediate to advanced
670 pages
17h 35m
English
It's time to add more cars:
moreCars := LoadMoreCars()PrintCars("More Cars, Domestic, Numeric, GM", cars.AddCars(moreCars). Filter(ByDomestic()). Filter(ByHasNumber()). Filter(ByMake("GM")))
The output of this is as follows:
More Cars, Domestic, Numeric, GM-----------------------car: GM Hummer H2car: GM Hummer H3car: GM Oldsmobile Delta 88car: GM Oldsmobile 442
Wait, what? AddCars? How is that an HOF? AddCars neither takes a function nor returns a function. Even worse, it mutates the cars collection.