Enum

sum_by/2

sum_by(enumerable, fun)

Maps and computes the sum of the given enumerable in one pass.

Raises ArithmeticError if fun returns a non-numeric value.