The OpenD Programming Language

Mean

Output range to calculate the mean online. Getter for mean costs a branch to * check for N == 0. This struct uses O(1) space and does *NOT* store the * individual elements. * * Note: This struct can implicitly convert to the value of the mean. * * Examples: * --- * Mean summ; * summ.put(1); * summ.put(2); * summ.put(3); * summ.put(4); * summ.put(5); * assert(summ.mean == 3); * ---

Alias This

mean

// Allow implicit casting to double, by returning the current mean.

Members

Functions

put
void put(double element)
put
void put(typeof(this) rhs)

Adds the contents of rhs to this instance.

toString
string toString()

Properties

N
double N [@property getter]
mean
double mean [@property getter]
sum
double sum [@property getter]
toMean
Mean toMean [@property getter]

Simply returns this. Useful in generic programming contexts.

Meta