Hello, I ran into this problem recently:
julia> a = Array{Int,1}[]
0-element Array{Array{Int64,1},1}
julia> b = zeros(Int,2)
2-element Array{Int64,1}:
0
0
julia> b[1] = 1
1
julia> push!(a,b)
1-element Array{Array{Int64,1},1}:
[1,0]
julia> b[1] = -1
-1
julia> push!(a,b)
2-element Array{Array{Int64,1},1}:
[-1,0]
[-1,0]
I'm wondering why a[1] changes to [-1,0]. Is it because only a reference to
b is stored when it is pushed to a? Are there any simple solutions to avoid
this?
Thanks!
Amuthan
