I have this big function that I defined on a vector, but I'd like it to work also with a single value. I'd like the type of the first argument to be either a vector or a number.
I triend the following:
function bigfunction(x::Vector, y::Float64=0.5)
# lots of stuff
z = x .+ y
return z
end
bigfunction(x::Number) = bigfunction()
The function works on a vector, but not on the number.
bigfunction([0, 1, 3])
bigfunction(2)
Should I do something with Union{} as I've seen sometimes? Or redefining the method in a different way?