How to find an average value, without having to store every data point
This was a solution to a problem I was trying to solve on my webiste: how can I arrive at an average value over time, when new data is being provided, without having to store every datum.
I wrote this code to prove to myself that I wasn't crazy, and that this was indeed a valid way to calculate the mean.