On Wed, Apr 6, 2016 at 4:23 PM, Po Choi <vegetableb...@gmail.com> wrote: > > hello(A::Matrix) = 1 > hello(A::Vector{Matrix}) = 2
http://julia.readthedocs.org/en/latest/manual/types/#parametric-composite-types Vector{Matrix{Float64}} is not a subtype of Vector{Matrix} > A = randn(3,3); > AA = [randn(3,3) for k in 1:4]; > hello(A) > hello(AA) > > The output has method error. > julia> hello(A) > 1 > > julia> hello(AA) > ERROR: MethodError: `hello` has no method matching > hello(::Array{Array{Float64,2},1}) > > > If I write down the types explicitly, > hi(A::Array{Float64,2}) = 1 > hi(A::Array{Array{Float64,2},1}) = 2 > A = randn(3,3); > AA = [randn(3,3) for k in 1:4]; > hi(A) > hi(AA) > The output is what I expect. > julia> hi(A) > 1 > > julia> hi(AA) > 2 > > Am I using Vector and Matrix in a wrong way?