Created
May 29, 2015 11:23
-
-
Save jhedev/87b2e5d86f4361a237c4 to your computer and use it in GitHub Desktop.
Revisions
-
jhedev created this gist
May 29, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ problem4 :: [Int] -> Int problem4 = read . foldl1 (++) . map show . sortBy f f:: Int -> Int -> Ordering f x y | v1 == v2 = EQ | v1 < v2 = GT | v1 > v2 = LT where v1 = concatInt x y v2 = concatInt y x toString :: Int -> Int -> String toString a b = show a ++ show b concatInt :: Int -> Int -> Int concatInt a = read . toString a