Created
September 15, 2013 03:01
-
-
Save antifuchs/6567690 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 sessionNumber(line: &str) -> Option<int> { | |
match(line.as_slice().split_iter(':').next()) { | |
Some(first) => int::from_str(first), | |
_ => None | |
} | |
} | |
fn occupiedSessions(output: ~str) -> @HashSet<int> { | |
let set = @HashSet::new(); | |
for line in output.line_iter(){ | |
// v----- screams "match arms have incompatible types: expected `bool` but found `()` (expected bool but found ())" | |
match sessionNumber(line) { | |
Some(n) => set.insert(n), | |
None => () | |
} | |
() | |
} | |
set | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment