Sorting algorithms/Sleep sort: Difference between revisions
Content added Content deleted
(→{{header|UNIX Shell}}: Added zkl) |
(Add Julia) |
||
Line 681: | Line 681: | ||
</pre> |
</pre> |
||
=={{header|Julia}}== |
|||
<lang Julia>input = [3,2,4,7,3,6,9,1] |
|||
output = Int[] |
|||
@sync for i in input |
|||
@async begin |
|||
sleep(i) |
|||
push!(output, i) |
|||
end |
|||
end |
|||
@assert output == sort(input) |
|||
println(output)</lang> |
|||
{{out}} |
|||
<pre>[1,2,3,3,4,6,7,9]</pre> |
|||
=={{header|Lua}}== |
=={{header|Lua}}== |
||
Here's a slow implementation using only stock C Lua: |
Here's a slow implementation using only stock C Lua: |