[plug] qsort

The Thought Assassin assassin at live.wasp.net.au
Mon Jun 10 13:34:55 WST 2002


On Sun, 9 Jun 2002, Cameron Patrick wrote:
> On Sun, Jun 09, 2002 at 04:39:08PM +0800, Richard wrote:
> > Wouldn't it be easier just to write your own simple sort.
> Okay, here goes...

<27 lines of icky C code>

Bah. Try this:

qsort lt []     = []
qsort lt (x:xs) = qsort lt y ++ [x] ++ qsort lt z
                  where (y,z) = partition (lt x) xs

Now that is a thing of beauty.

-Greg



More information about the plug mailing list