[Haskell-cafe] k-minima in Haskell

Tim Chevalier catamorphism at gmail.com
Thu Apr 12 00:20:12 EDT 2007


On 4/11/07, Stefan O'Rear <stefanor at cox.net> wrote:
>
> If you want to be really explicit about it, here is a sort that will
> work:
>
> sort [] = []
> sort l@(x:_) = filter (<x) l ++ filter (==x) l ++ filter (>x) l
>
> (A stable quicksort, btw)

You may be missing a few recursive calls there :-)

Cheers,
Tim

-- 
Tim Chevalier * chevalier at alum.wellesley.edu * Often in error, never in doubt
Confused? See http://catamorphism.org/transition.html


More information about the Haskell-Cafe mailing list