public function average() { return $this->defaultIfEmpty(Observable::error(new \UnderflowException()))->reduce(function ($a, $x) { static $count = 0; static $total = 0; $count++; $total += $x; return $total / $count; }, 0); }