Think spaces are needed here, but I defer to @rxin: `weights.map(_ / sum).scanLeft(0.0d)(_ + _)`.