Closed
Description
This is sorta inconsistent :(
fn sort_by(self, compare: |&T, &T| -> Ordering)
fn max_by<B: Ord>(&mut self, f: |&A| -> B) -> Option<A>
Having a comparison function is kinda more useful because then you could use min_by
/max_by
with non-total Ord
types more easily, but it's also a bit more effort in the easy case. I dunno. fwiw, ruby's sort_by
takes a "scoring"-like block and haskell's sortBy
takes a comparison function.