Created
May 24, 2014 21:00
-
-
Save schmee/706738b5099ba9e8f2c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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