Anonymous user
Sort a list of object identifiers: Difference between revisions
Sort a list of object identifiers (view source)
Revision as of 18:47, 25 February 2017
, 7 years ago→{{header|Haskell}}
m (→{{header|REXX}}: changed/added comments and whitespace, added whitespace to the ouput.) |
|||
Line 134:
=={{header|Haskell}}==
<lang Haskell>import Data.List ( sort , intercalate )
oid :: [String]▼
oid = ["1.3.6.1.4.1.11.2.17.19.3.4.0.10",▼
"1.3.6.1.4.1.11.2.17.5.2.0.79" ,▼
"1.3.6.1.4.1.11.2.17.19.3.4.0.4" ,▼
"1.3.6.1.4.1.11150.3.4.0.1" ,▼
"1.3.6.1.4.1.11.2.17.19.3.4.0.1" ,▼
"1.3.6.1.4.1.11150.3.4.0"]▼
splitString :: Eq a => (a) -> [a] -> [[a]]
Line 152 ⟶ 144:
convertIntListToString = intercalate "." . map show
orderOID :: [String] -> [String]
orderOID = map convertIntListToString . sort . map ( map read . splitString '.' )
▲oid :: [String]
▲oid = ["1.3.6.1.4.1.11.2.17.19.3.4.0.10" ,
▲ "1.3.6.1.4.1.11.2.17.5.2.0.79" ,
▲ "1.3.6.1.4.1.11.2.17.19.3.4.0.4" ,
▲ "1.3.6.1.4.1.11150.3.4.0.1" ,
▲ "1.3.6.1.4.1.11.2.17.19.3.4.0.1" ,
▲ "1.3.6.1.4.1.11150.3.4.0"]
main :: IO ( )
main = do
mapM_ putStrLn $ orderOID oid</lang>
{{out}}
|