Array{<:Any} is not the same as Array{<:}?

julia> Array{<:Any} == Array{<:}
false

So what’s the difference?

julia> Array{<:}
Array{<:,N} where N

it’s an array whose eltype is <:. Being <: a function, it has a type. It’s a like a vector with type sin:

julia> Vector{sin}
Array{sin,1}
3 Likes

To expand on that:

julia> [1, 2, 3] isa Vector{<:}
false

julia> [1, 2, 3] isa Vector{<:Any}
true
1 Like

Oh, right. Thanks!

Actually in the definition of Array{T, N} there is no hard requirement for what T, N is until instantiation.

So T can be anything and N can be anything ee.g.

Array{Array, Array} works but of course you can’t instantiate any Array with that type signature as the N is meant to encode the dimension.

1 Like

All I see is {<:}, so [ 😄, 😃, 😸, 😺] isa Vector{<:} should be true.

1 Like