Sort a list of object identifiers: Difference between revisions

m
(→‎{{header|zkl}}: added code)
m (→‎{{header|zkl}}: fix link)
Line 244:
 
=={{header|zkl}}==
{{trans|Translation of http://rosettacode.org/wiki/Natural_sorting#zkl}}
 
Basically, blow apart each line into a list of numbers and sort that.
<lang zkl>fcn sortOIDS(oids){
oids:=oids.pump(List(),fcn(oid){ oid[1,*].split(".").apply("toInt") });
oids.sort( // in place sort
fcn(a,b){ // a&b are (x,y,z,...), eg L(0,4,2,54)
a.zip(b).reduce(fcn(_,[(a,b)]){
if(a==b)return(True); // continue to next field
Anonymous user