[Haskell-cafe] k-minima in Haskell

Stefan O'Rear stefanor at cox.net
Thu Apr 12 00:24:29 EDT 2007


On Wed, Apr 11, 2007 at 09:20:12PM -0700, Tim Chevalier wrote:
> 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 :-)

Indeed.

Stefan


More information about the Haskell-Cafe mailing list