Array
is the built-in multidimensional array type, and in particular it is a family of types Array{T,N}
: N
-dimensional arrays of element type T
. Vector{T}
is an alias for Array{T,1}
and Matrix{T}
is an alias for Array{T,2}
.
Array
is a subtype of the abstract AbstractArray
type — by accepting AbstractArray
rather than Array
, you allow your code to be used with other array types. An example in Base is a range like 1:100
, which is acts like a 1d array but its elements are computed as needed. Other examples in external packages include StaticArrays and GPUArrays.
In general, the more people you expect to re-use your code, the more generic you should try to be, so that they can combine your code arbitrarily with different packages. But as long as it is mostly you using your code, you can always go back and add more type parameters to make your code more generic. As you get more experience working with Julia, you should learn to instinctively write more generic code by default.
You almost always want to parameterize by concrete types. For an explanation of why this is a critical distinction, see: