Jump to content

Sort a list of object identifiers: Difference between revisions

added Factor
m (→‎Using Coroutine: removed efficiency comment, seems coroutine overhead not cheap, efficiency depend on data.)
(added Factor)
Line 198:
|> Enum.each(fn oid -> IO.puts oid end)</lang>
 
{{out}}
<pre>
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.1
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.10
1.3.6.1.4.1.11150.3.4.0
1.3.6.1.4.1.11150.3.4.0.1
</pre>
 
=={{header|Factor}}==
Factor provides the <code>human<=></code> word which converts numbers in a string to integers before comparing them.
<lang factor>USING: io qw sequences sorting sorting.human ;
IN: rosetta-code.sort-object-ids
 
CONSTANT: input qw{
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
}
 
input [ human<=> ] sort [ print ] each</lang>
{{out}}
<pre>
1,827

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.