Hello
This is a question I have been wondering for a while: why all the functions in the statistics::Statistics trait take self and not &self ?
I often have the use case where I need to compute several statistics on the same dataset, like for example:
use statrs::statistics::Statistics;
fn main() {
let dataset = vec![0., 1., 2., 3., 4., 5.];
let mean = dataset.mean();
let variance = dataset.variance();
}
but I cannot do so because mean(self) function takes ownership on the dataset. The only solution I see is to clone the dataset, which in my use case is usually not wanted.
Naïvely, if I had to implement a mean() function, I would only need an immutable reference on the dataset to do so, so I am wondering if there is a specific reason for this particular design choice, and could it change in the future ?