
2 Mar
2009
2 Mar
'09
6:06 a.m.
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