running_avg(stream) that consumes numbers and yields the average of everything seen so far after each one — one pass, O(1) state (count and total), no storing the history.list(running_avg([10, 20, 60]))
[10.0, 15.0, 30.0]
Averages after each arrival.
total += x; count += 1; yield total / count.
No lists.