February 2014
Intermediate to advanced
160 pages
4h 59m
English
We’ve gone over quite a few techniques to manipulate collections so far: picking matching elements, selecting a particular element, and transforming a collection. All these operations have one thing in common: they all worked independently on individual elements in the collection. None required comparing elements against each other or carrying over computations from one element to the next. In this section we look at how to compare elements and carry over a computational state across a collection.
Let’s start with some basic operations and build up to something a bit more sophisticated. As the first example, let’s read over the values in the friends collection of names and determine the total number of ...