June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -1,12 +1,14 @@
input = [3,2,4,7,3,6,9,1]
output = Int[]
@sync for i in input
@async begin
sleep(i)
push!(output, i)
function sleepsort(arr::Vector{<:Real})
out = Vector{eltype(arr)}(0)
sizehint!(out, length(arr))
@sync for x in arr
@async begin
sleep(x)
push!(out, x)
end
end
return out
end
@assert output == sort(input)
println(output)
v = rand(-10:10, 10)
println("# unordered: $v\n -> ordered: ", sleepsort(v))