Largest int from concatenated ints: Difference between revisions

→‎Haskell: Add implementation
(Slight layout change in task description. (No new info).)
(→‎Haskell: Add implementation)
Line 93:
 
<pre>(998764543431 6054854654)</pre>
 
=={{header|Haskell}}==
<lang Haskell>import Data.List (sortBy)
import Data.Ord (comparing)
 
main = print (map maxcat [[1,34,3,98,9,76,45,4], [54,546,548,60]] :: [Int])
where sorted = sortBy (flip $ comparing $ cycle . show)
maxcat = read . concat . map show . sorted</lang>
 
{{out}}
 
<pre>[998764543431,6054854654]</pre>
 
=={{header|J}}==