Chang
Chang

Reputation: 876

The best way to define an array of tuples in julia

In Julia v0.4, the following two works:

Array{Tuple{Int, Int}}(10)

and

 Array(Tuple{Int, Int}, 10)

Which is the better way? Is there any reason that one should be preferred to another?

I recognized that a previously working code

 Array((Int, Int), 10)

no longer works in Julia v0.4. I am afraid that one of the above two currently working code also does not work in the future.

Upvotes: 2

Views: 1028

Answers (1)

Daniel Arndt
Daniel Arndt

Reputation: 2543

From the docs, Array(T, dims) is deprecated, so I would go with the first.

http://docs.julialang.org/en/release-0.4/stdlib/arrays/#Base.Array

Upvotes: 4

Related Questions