Returns the arithmetic mean of values, or 0 if empty.
values
0
static double average(Iterable<num> values) { if (values.isEmpty) return 0; return values.fold<double>(0, (a, b) => a + b) / values.length; }