JosephTLyons / outliers

A Rust crate used to identify outliers in a data set
GNU General Public License v3.0
1 stars 0 forks source link

Use iterators where possible #5

Closed JosephTLyons closed 4 years ago

JosephTLyons commented 4 years ago

It is possible that after those functions are made into generic functions, that the code in the get_outiers() could use iterators:

let mut lower_outliers: Vec<usize> = data_vec
    .iter()
    .filter(|a| (**a as f32) < lower_range)
    .collect();
let mut upper_outliers: Vec<usize> = data_vec
    .iter()
    .filter(|a| (**a as f32) > lower_range)
    .collect();
JosephTLyons commented 4 years ago

This doesn't seem like a good idea now that we are collecting a third vector of items, the non-outliers, which require us to know what is left after checking to see if the item belongs in the lower or upper outlier vec.