How do I sort this list?
c#, haskell, python, ruby, sorting
Solution
With a little bit of LINQ:
var q = from el in li
orderby foo(el)
select el;
li = q.ToList();
Problem
I have a list of lists. ``` List<List<T>> li = { {a1,a2,a3 ... aN}, {b1,b2,b3 ... bN}, ... }; double foo(List<T> list) { // do something // e.g {1,2,3} // it = 1 + 2 + 3 return it; } ``` Now I want to sort `li` in such a way that higher the `foo(x)` for a `x` higher it should appear in a sorted list. What is the best way in C#/Python/any other lang to this?