Assert that 2D-Array never reduce to vector?

This should not happen, and would constitute a type instability. Search functions that return vectors, always do that, so for example:

julia> findall(>(2), 1:4)
2-element Array{Int64,1}:
 3
 4

julia> findall(>(3), 1:4)
1-element Array{Int64,1}:
 4

julia> findall(>(4), 1:4)
Int64[]

It should always return a vector. Other functions like findfirst either return a scalar index or nothing.

If you have search functions that sometimes return one or the other, like you say, that should be fixed.

1 Like