Sort a list of object identifiers: Difference between revisions
Sort a list of object identifiers (view source)
Revision as of 10:44, 8 February 2024
, 3 months ago→{{header|Wren}}: Minor tidy
m (→{{header|Wren}}: Minor tidy) |
|||
(5 intermediate revisions by 3 users not shown) | |||
Line 688:
end zipWith</syntaxhighlight>
{{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|Arturo}}==
<syntaxhighlight lang="arturo">lst: [
"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"
]
print.lines arrange lst 'x ->
sum map.with:'i to [:integer] split.by:"." x 'z ->
z * 10^(20-i)</syntaxhighlight>
{{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
Line 893 ⟶ 916:
{{out}}
<pre>
$ patscc -DATS_MEMALLOC_GCBDW oid_sort.dats -lgc && ./a.out
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
Line 1,355 ⟶ 1,379:
=={{header|Fōrmulæ}}==
{{FormulaeEntry|page=https://formulae.org/?script=examples/Sort_a_list_of_object_identifiers}}
'''Solution'''
[[File:Fōrmulæ - Sort a list of object identifiers 01.png]]
[[File:Fōrmulæ - Sort a list of object identifiers 02.png]]
'''Test case'''
[[File:Fōrmulæ - Sort a list of object identifiers 03.png]]
[[File:Fōrmulæ - Sort a list of object identifiers 04.png]]
=={{header|Go}}==
Line 2,817 ⟶ 2,849:
{{libheader|Wren-fmt}}
{{libheader|Wren-sort}}
<syntaxhighlight lang="
import "./sort" for Sort
var oids = [
|