I’m writing a function that needs to return a variable-length collection of arrays (depending on parameters in a file as well as optional function arguments). Each array may also have a different size. I can return the collection as a tuple of arrays or as an array of arrays. In the function, I want to allocate memory for the collection **before** filling in the array values. I do realize that a tuple is immutable, but it turns out that one *can* alter the array elements even when they’re indexed via the tuple(!).

For the tuple-based approach, it would look something like this:

```
t = (zeros(Int,2),)
t = t...,zeros(Int,3)
t[1][2] = 1 # this works even though t is immutable!
@show t;
```

which produces

```
t = ([0, 1], [0, 0, 0])
```

For the array-based approach, it goes like this

```
a = [Int[]]
pop!(a)
push!(a,zeros(Int,2))
push!(a,zeros(Int,3))
a[1][2] = 1
@show a;
```

which gives

```
a = Array{Int64,1}[[0, 1], [0, 0, 0]]
```

One advantage to the *array* approach is that I can `push!`

inside a loop, without any special assignment on the first iteration. I couldn’t figure out how to do that with the *tuple* approach, because one cannot splat an empty tuple.

Other than that detail, which approach is best? I hope to get an answer before benchmarking both approaches.

Thanks in advance!