Iterable<double> group(int n) sync* { double acc = 0; int c = 1; for (var e in this) { acc += e; if ((c % n) == 0) { yield (acc / n); acc = 0; } c++; } }