[Haskell-beginners] Re: let indenting problems
Heinrich Apfelmus
apfelmus at quantentunnel.de
Mon Mar 2 06:06:31 EST 2009
7stud wrote:
>
> import Data.List (sortBy)
>
> mySort xs = sortBy myCompare xs
> where myCompare x y
> | lx < ly = LT
> | lx == ly = EQ
> | lx > ly = GT
> where lx = length x
> ly = length y
How about
import Data.Ord (comparing)
mySort = sortBy (comparing length)
or at least
mySort = sortBy myCompare
where
myCompare x y = compare (length x) (length y)
Regards,
apfelmus
--
http://apfelmus.nfshost.com
More information about the Beginners
mailing list