I am trying to initialize a variable as `arr = Vector{Tuple{Float64, Vector{Float

I am trying to initialize a variable as arr = Vector{Tuple{Float64, Vector{Float64}}}() because I will grow it with push!
However, I would like to have more than that, the first type is fixed as Float64 but I want to have more than one Vector{Float64} , e.g. arr = Vector{Tuple{Float64, Vector{Float64}, Vector{Float64}}}() .
Is there a way to initialized my variable with N tuple elements of the same type? I don’t expect more than 5.

Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message :slack:) (More Info)

1 Like

Answer from Slack by @mcabbott:

Tuple{Int, Tuple{(Vector{Int} for _ in 1:3)...}}` or maybe better `Tuple{Int, Tuple{ntuple(_ -> Vector{Int}, 3)...}}

This is what I used in the end:

N = 3
arr = Vector{Tuple{Float64, (Vector{Float64} for _ in 1:N)...}}()
2 Likes