I have a function when I want to be sure one parameter is a vector, even if it is given as number.
I thought to use reshape(myInt,1)
but notice reshape of numbers is not in Base
.
No problem, I can add a method to handle it:
import Base.reshape
function reshape(x::Number, dims...) where {T <: Number}
x = [x]
reshape(x,dims)
end
But, as it is not in Base
, I wonder if it is a good approach or it is intentionally left it out from Base
.