Re: [rust-dev] Sorting & generics

2013-02-03 Thread Glenn Willen
Oh, final reply to myself: I didn't notice that, in the original code, you did 'let part' instead of 'let mut part', in the generic function. After fixing that, the code works. Glenn On Feb 3, 2013, at 12:24 AM, Glenn Willen wrote: > Okay, at least in 0.5, multiple traits are spelled with a sp

Re: [rust-dev] Sorting & generics

2013-02-03 Thread Glenn Willen
Okay, at least in 0.5, multiple traits are spelled with a space, not a comma, oops. So it should be, after fixing most of the errors: use cmp::{Ord, Eq}; ... fn foo_generic... There is one error left that I haven't figured out: /tmp/foo.rs:7:16: 7:20 error: illegal borrow: creating mutable ali

Re: [rust-dev] Sorting & generics

2013-02-02 Thread Glenn Willen
I believe you need to specify, when declaring foo_generic, that your type T has the Ord trait (i.e. that objects of type T can be ordered, which is necessary in order for them to be sorted.) I think the way to do that is fn foo_generic... When I test this, I have to 'use cmp::Ord;' in order to

[rust-dev] Sorting & generics

2013-02-02 Thread Alexander Stavonin
Hi, I'm not sure it is an defect or failure to fully understand from my side. I'd like to sort an array. Unfortunately, it is not easy to understand which sort function should be used, but looks like quick_sort3 is good enough. Than: 1 extern mod std; 2 use std::sort::*; 3 4 fn foo_g