Sort stability: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
(added Arturo)
Line 400: Line 400:
US Birmingham"
US Birmingham"
</syntaxhighlight>
</syntaxhighlight>

=={{header|Arturo}}==

<syntaxhighlight lang="arturo">records: @[
#[country: "UK", city: "London"]
#[country: "US", city: "New York"]
#[country: "US", city: "Birmingham"]
#[country: "UK", city: "Birmingham"]
]

print "Original order:"
loop records => print

print "\nSorted by country name:"
loop sort.by:'country records => print

print "\nSorted by city name:"
loop sort.by:'city records => print</syntaxhighlight>

{{out}}

<pre>Original order:
[country:UK city:London]
[country:US city:New York]
[country:US city:Birmingham]
[country:UK city:Birmingham]

Sorted by country name:
[country:UK city:London]
[country:UK city:Birmingham]
[country:US city:New York]
[country:US city:Birmingham]

Sorted by city name:
[country:US city:Birmingham]
[country:UK city:Birmingham]
[country:UK city:London]
[country:US city:New York]</pre>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==