Say that I have an array of some composite type in Julia. I understand that I can't simply assign values into the array since its elements are undefined. For example the code
type struct
u::Int64
v::Int64
end
X = Array(struct, 100)
X[10].u = 3
will generate this error:
ERROR: access to undefined reference
in getindex at array.jl:277
in include at boot.jl:238
in include_from_node1 at loading.jl:114
What is the standard way to deal with this? For now I am just doing something like:
samples = Array(Sample1d, num_samples)
fill!(samples, Sample1d(0, 0, 0))
samples[i] = ...
Is there a more concise or Julian way to do this?