starting from:
x = rand(0:20,4)
y = rand(0:20,4)
After trying those:
@time [[i...] for i in zip(x,y)]
@time [collect(i) for i in zip(x,y)]
@time diag([[i,j] for i in x,j in y])
@time [[x[k], y[k]] for k = 1:length(x)]
@time [hcat(p...) for p in zip(x, y)]
the most efficient way (for little vectors at least) is:
[collect(i) for i in zip(x,y)]
Vector{Int64}[4]
Int64[2]
Int64[2]
Int64[2]
Int64[2]
@GunnarFarneback my output is a bit different from yours , is it because our version of Julia is different?
(4-element Array{Array{Int64,1},1}: vs Vector{Int64}[4])
thx again