Decorate-sort-undecorate idiom: Difference between revisions

m
→‎{{header|Wren}}: Better alignment
(Added Wren)
m (→‎{{header|Wren}}: Better alignment)
Line 161:
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|
System.print(a.map { |e| [e, f.call(e)] } // decorate
.toList
.sort { |p, q| p[1] < q[1] } // sort
9,488

edits