Aggregates every value in this collection with the result collected up to that index.
The callback argument is a function that will accept the result collected so
far, the value for each entry, the key or index, and the collection itself.
Its return value will become the new accumulated result.
reduce will return the accumulated result upon visiting every index.
The second argument is a
basis, the aggregate result before any value has been
visited, and the ultimate result if this collection is empty.
Array implementation establishes a precedent that the basis should be
If the user provides no basis and the collection is empty,
reduce throws an
However, at time of writing, all other collections in this library require an
This is a shortcoming that should be rectified in version 2.
iterate are the basis for many generic collection methods
iterate is more appropriate for
every, which may finish before
visiting every entry in the collection.
reduceRight does not accept an optional
Other collections do.
If this collection is an array with holes, those entries will not be visited.
Aggregates every value in this collection, from right to left.
Iterates every value in this collection.
Calls the callback for each entry in the collection.
Returns an array of the respective return values of a callback for each entry in this collection.
Returns an array with each value from this collection that passes the given test.