Skip to content

Instantly share code, notes, and snippets.

@schmee
Created May 24, 2014 21:00
Show Gist options
  • Save schmee/706738b5099ba9e8f2c6 to your computer and use it in GitHub Desktop.
Save schmee/706738b5099ba9e8f2c6 to your computer and use it in GitHub Desktop.
fn main() {
// CountedSet is HashMap<uint, uint>, with the counts of each key
let numbers = [1u, 1, 1, 2, 2, 3, 1];
let more_numbers = [1u, 1, 2];
let count1: CountedSet<uint> = numbers.iter().map(|&x|x).collect();
let count2: CountedSet<uint> = more_numbers.iter().map(|&x|x).collect();
println!("{}", count1);
println!("{}", count2);
for (o, e) in Repeat::new(&count1.iter()).zip(count2.iter()) {
println!("{:?} ---- {:?}", o, e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment