Skip to content

Instantly share code, notes, and snippets.

@ajuckel
Created October 17, 2013 03:31
Show Gist options
  • Save ajuckel/7018861 to your computer and use it in GitHub Desktop.
Save ajuckel/7018861 to your computer and use it in GitHub Desktop.
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