Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rust sort sample
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