This code:

  fill(Array(Int64,1),3,3,3)

Constructs a 3D array of length 3 in each dimension where each element is a 
reference to the same single element array containing a single Int64.  The 
Int64 is uninitialised, so it has the value of whatever that piece of 
memory happens to hold.  You should have used curly braces to specify the 
type (rather than parentheses, which constructs an Array object):

  fill(Array*{*Int64,1*}*,3,3,3)

but like Milan says, I don't think that can be what you want, because you 
are making a 3D array where each element is a reference to the same array. 
 What do you actually want each element of your array to hold?  To create a 
3D array filled with zero integers, all you need to do is:

julia> a = fill(0,3,3,3)
3x3x3 Array{Int64,3}:
[:, :, 1] =
 0  0  0
 0  0  0
 0  0  0

[:, :, 2] =
 0  0  0
 0  0  0
 0  0  0

[:, :, 3] =
 0  0  0
 0  0  0
 0  0  0

Or you can be be specific about the type if you need to:

julia> a = fill(Int16(0),3,3,3)
3x3x3 Array{Int16,3}:
[:, :, 1] =
 0  0  0
 0  0  0
 0  0  0

[:, :, 2] =
 0  0  0
 0  0  0
 0  0  0

[:, :, 3] =
 0  0  0
 0  0  0
 0  0  0

Integers are immutable types, so are passed by copying, not reference, and 
so each element has its own value.

Reply via email to