
20 Mar
2007
20 Mar
'07
8:54 a.m.
Thomas Hartman wrote:
To answer my own post, the Data.List.sort *is* necessary.
Otherwise, you get alphabetic sort.
Which is why you do the Set trick at a different stage in the process, like this:
interact $ unlines . map show
-- more efficient than -- reverse . take 10 . reverse . ( \s -> drop (length s - 10 ) s ) . Data.Set.toAscList . Data.Set.fromList -- move it *here* after integer conversion and it sorts and nubs for you . map ( read :: String -> Integer ) . filter ( all Data.Char.isDigit ) . lines'