Sort a list of object identifiers: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: changed/added comments and whitespace, added whitespace to the ouput.) |
|||
Line 134: | Line 134: | ||
=={{header|Haskell}}== |
=={{header|Haskell}}== |
||
<lang Haskell>import Data.List ( sort , intercalate ) |
<lang Haskell>import Data.List ( sort , intercalate ) |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
splitString :: Eq a => (a) -> [a] -> [[a]] |
splitString :: Eq a => (a) -> [a] -> [[a]] |
||
Line 152: | Line 144: | ||
convertIntListToString = intercalate "." . map show |
convertIntListToString = intercalate "." . map show |
||
orderOID :: [String] |
orderOID :: [String] -> [String] |
||
orderOID = map convertIntListToString . sort . |
orderOID = map convertIntListToString . sort . map ( map read . splitString '.' ) |
||
map ( map read . splitString '.' ) $ oid |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
main :: IO ( ) |
main :: IO ( ) |
||
main = do |
main = do |
||
mapM_ putStrLn orderOID</lang> |
mapM_ putStrLn $ orderOID oid</lang> |
||
{{out}} |
{{out}} |