Sort a list of object identifiers: Difference between revisions
Content added Content deleted
(→{{header|Haskell}}: or using Data.List.Split) |
|||
Line 206: | Line 206: | ||
1.3.6.1.4.1.11150.3.4.0 |
1.3.6.1.4.1.11150.3.4.0 |
||
1.3.6.1.4.1.11150.3.4.0.1</pre> |
1.3.6.1.4.1.11150.3.4.0.1</pre> |
||
Where Data.List.Split is available (https://hackage.haskell.org/package/split-0.2.3.1/docs/Data-List-Split.html) |
|||
we can alternatively write: |
|||
<lang haskell>import Data.List.Split (splitOn) |
|||
import Data.List (sort, intercalate) |
|||
-- SORTING OBJECT IDENTIFIERS ------------------------------------------------ |
|||
oidSort :: [String] -> [String] |
|||
oidSort = |
|||
(intercalate "." <$>) . |
|||
((show <$>) <$>) . sort . ((readInt <$>) <$>) . (splitOn "." <$>)</lang> |
|||
=={{header|J}}== |
=={{header|J}}== |