Decorate-sort-undecorate idiom: Difference between revisions

Content added Content deleted
imported>Tybalt89
m (→‎{{header|Wren}}: Changed to Wren S/H)
Line 1,033: Line 1,033:


It's not specified how words of equal length are to be sorted. The standard sort() method used here (quicksort under the hood) is unstable and so the sort order for such words is not guaranteed.
It's not specified how words of equal length are to be sorted. The standard sort() method used here (quicksort under the hood) is unstable and so the sort order for such words is not guaranteed.
<syntaxhighlight lang="ecmascript">var schwartzian = Fn.new { |a, f|
<syntaxhighlight lang="wren">var schwartzian = Fn.new { |a, f|
System.print(a.map { |e| [e, f.call(e)] } // decorate
System.print(a.map { |e| [e, f.call(e)] } // decorate
.toList
.toList