20080115

Twin naming golf

I saw Brad Fitzpatrick's post on anagram twin names and decided to join in the golf. Weeee!


import Control.Arrow ( first , second , (&&&) , (***) )
import List ( sortBy , groupBy , intersperse )

main = interact $ unlines
. map ( uncurry (++) )
. map ( ( ++ " : " ) . fst . head &&& concat . intersperse ", " . map snd )
. filter ( (> 1) . length )
. groupBy ( curry $ uncurry (==) . (***) fst fst )
. sortBy (curry $ uncurry compare . (***) fst fst )
. map ( sortBy compare &&& id )
. filter ( not . null )
. map ( fst . break (== ' ') )
. lines


hehehe

No comments:

About Me

(2) the subculture of the compulsive programmer, whose ethics prescribe that one silly idea and a month of frantic coding should suffice to make him a life-long millionaire. --ewd1036