Sorting algorithms/Bead sort: Difference between revisions

m
m (→‎{{header|REXX}}: Mixed case for keywords!)
m (→‎{{header|Wren}}: Minor tidy)
 
(One intermediate revision by one other user not shown)
Line 3,117:
Say right('element',30) right(k,w) txt':' right(word(slist,k),9)
End
Return</syntaxhighlight>
l</syntaxhighlight>
{{out|output|text=&nbsp; when using the default input:}}
(Shown at three-quarter size.)
Line 3,497 ⟶ 3,496:
=={{header|Wren}}==
A translation of the Python code in the Wikipedia article. Only works properly for lists of non-negative integers.
<syntaxhighlight lang="ecmascriptwren">var beadSort = Fn.new { |a|
var res = []
var max = a.reduce { |acc, i| (i > acc) ? i : acc }
Line 3,511 ⟶ 3,510:
}
 
var asarray = [ [4, 65, 2, 31, 0, 99, 2, 83, 782, 1], [7, 5, 2, 6, 1, 4, 2, 6, 3] ]
for (a in asarray) {
System.print("Before: %(a)")
a = beadSort.call(a)
9,485

edits