Skip to content

Commit

Permalink
Fix iris.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe-Cholet authored and phimuemue committed Feb 6, 2024
1 parent 1c12851 commit 3024f95
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/iris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ fn main() {
let mut plot_symbols = "+ox".chars().cycle();
let mut symbolmap = HashMap::new();

// using Itertools::group_by
for (species, species_group) in &irises.iter().group_by(|iris| &iris.name) {
// using Itertools::chunk_by
for (species, species_chunk) in &irises.iter().chunk_by(|iris| &iris.name) {
// assign a plot symbol
symbolmap
.entry(species)
.or_insert_with(|| plot_symbols.next().unwrap());
println!("{} (symbol={})", species, symbolmap[species]);

for iris in species_group {
for iris in species_chunk {
// using Itertools::format for lazy formatting
println!("{:>3.1}", iris.data.iter().format(", "));
}
Expand Down

0 comments on commit 3024f95

Please sign in to comment.