Amazingly short in code and even intuitive if you are a bit into functional programming:
Func< intlist, intlist > Sort =Taken from this presentation, also find more interesting features from C# 3.0 there.
xs =>
xs.Case(
() => xs,
(head,tail) => (Sort(tail.Where(x => x < head)))
.Concat
(Single(head))
.Concat
(Sort(tail.Where(x => x >= head)))
);
Now argue with me, that some languages are not clunky compared to this!

0 comments:
Post a Comment