Observe the following:
julia> a = [8,7,6]
3-element Array{Int64,1}:
8
7
6
julia> b = [a,a]
2-element Array{Array{Int64,1},1}:
[8, 7, 6]
[8, 7, 6]
julia> c=deepcopy(b)
2-element Array{Array{Int64,1},1}:
[8, 7, 6]
[8, 7, 6]
julia> c[1][1] = 9
9
julia> c
2-element Array{Array{Int64,1},1}:
[9, 7, 6]
[9, 7, 6]
So the point of this example is: The output c
of deepcopy
still contains two arrays that are actually the same object. This seems to contradict the documentation, which says that the copying continues recursively until the leaves are reached. If the above example is the intended behavior of deepcopy
, could someone give a precise definition of its functionality?