Sort a list of object identifiers: Difference between revisions

J: update example to match changed task
(→‎{{header|Perl 6}}: update to comply with new task description)
(J: update example to match changed task)
Line 280:
 
<lang J>oids=:<@-.&' ';._2]0 :0
.1.3.6.1.4.1.11.2.17.19.3.4.0.10
.1.3.6.1.4.1.1115011.32.417.05.2.0.79
.1.3.6.1.4.1.11.2.17.19.3.4.0.194
.1.3.6.1.4.1.11150.3.4.0.1
.1.3.6.1.4.1.11.2.17.19.3.4.0.221
.1.3.6.1.4.1.11.2.17.1911150.3.4.0.2
.1.3.6.1.4.1.11150.3.4.0.11
.1.3.6.1.4.1.11.2.17.19.3.4.0.1
.1.3.6.1.4.1.11.2.17.3773.0.2
.1.3.6.1.4.1.11.2.17.19.2.0.79
.1.3.6.1.4.1.11150.3.4.0.21
.1.3.6.1.4.1.11.2.17.19.2.0.9
.1.3.6.1.4.1.11.2.17.19.3.4.0.25
.1.3.6.1.4.1.11.2.17.19.3.4.0.32
.1.3.6.1.4.1.11.2.17.19.3.4.0.4
.1.3.6.1.4.1.11.2.17.19.3.4.0.31
.1.3.6.1.4.1.11.2.17.19.3.4.0.3
.1.3.6.1.4.1.11.2.17.3773.0.1
)</lang>
 
Line 304 ⟶ 292:
Sorting:
 
<lang J> >(/: __&".;._1&.('.'&,)&.>) oids
.1.3.6.1.4.1.11.2.17.195.2.0.979
.1.3.6.1.4.1.11.2.17.19.23.4.0.79 1
.1.3.6.1.4.1.11.2.17.19.3.4.0.14
.1.3.6.1.4.1.11.2.17.19.3.4.0.2 10
.1.3.6.1.4.1.11.2.17.1911150.3.4.0.3
.1.3.6.1.4.1.11.2.17.1911150.3.4.0.41 </lang>
.1.3.6.1.4.1.11.2.17.19.3.4.0.10
.1.3.6.1.4.1.11.2.17.19.3.4.0.19
.1.3.6.1.4.1.11.2.17.19.3.4.0.22
.1.3.6.1.4.1.11.2.17.19.3.4.0.25
.1.3.6.1.4.1.11.2.17.19.3.4.0.31
.1.3.6.1.4.1.11.2.17.19.3.4.0.32
.1.3.6.1.4.1.11.2.17.3773.0.1
.1.3.6.1.4.1.11.2.17.3773.0.2
.1.3.6.1.4.1.11150.3.4.0.1
.1.3.6.1.4.1.11150.3.4.0.2
.1.3.6.1.4.1.11150.3.4.0.11
.1.3.6.1.4.1.11150.3.4.0.21 </lang>
 
In other words, for our sort key, we break the contents of each box by the initial character and treat the remainder as numbers.
6,962

edits