Calculating mean and standard deviation with std.algorithm.reduce

jerro a at a.com
Wed Feb 13 06:33:56 PST 2013


> reduce!reducer(MQ(x.front, 0), zip(x, sequence!"n"))

A small correction : you would need to use x.drop(1) instead of 
x, because the first element of x is only used to compute the 
initial value of 1. If you wanted k to have the same meaning as 
the one in your formula, you would need to use sequence!"n + 2" 
instead of sequence!"n".


More information about the Digitalmars-d-learn mailing list