Apply a function against an accumulator and each element in a collection and return the accumulated result.