[Haskell-cafe] k-minima in Haskell
naur at post11.tele.dk
Fri Apr 13 09:08:15 EDT 2007
My Hugs tells me this:
Prelude> let sort  = ; sort l@(x:_) = filter (<x) l ++ filter (==x) l ++
filter (>x) l in sort [1,3,2]
So, no, this is not a working sorting function. Inserting the "few missing
Prelude> let sort  = ; sort l@(x:_) = sort ( filter (<x) l ) ++ filter
(==x) l ++ sort ( filter (>x) l ) in sort [1,3,2]
On Friday 13 April 2007 11:38, Thomas Hartman wrote:
> And for reference, here is again stefan's "stable" quicksort from his
> earlier post.
> sort  = 
> sort l@(x:_) = filter (<x) l ++ filter (==x) l ++ filter (>x) l
> (A stable quicksort, btw)
> This is the code whose legitimacy I am requesting confirmation of.
> 2007/4/13, Thomas Hartman <tphyahoo at gmail.com>:
> > > > You may be missing a few recursive calls there :-)
> > >
> > > Indeed.
More information about the Haskell-Cafe