Created
October 17, 2013 03:31
-
-
Save ajuckel/7018861 to your computer and use it in GitHub Desktop.
Rust sort sample
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
extern mod std; | |
fn main() { | |
let input = io::file_reader(&Path(os::args()[1])); | |
let output = result::get(&io::file_writer(&Path(os::args()[2]), [io::Append, io::Create])); | |
let mut lines = result::get(&input).read_lines(); | |
std::sort::quick_sort(lines, |a,b| { | |
str::le(*a, *b) | |
}); | |
for lines.each |l| { | |
output.write_line(*l); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment