I’m trying to call a function I’ve defined with only on method but will not call although I’m pretty sure all of my types are matching up
a=[1,2,3]
b=[3,2,1]
function foo(a::Array{Float64,1}, b::Array{Float64,1}, c)
#definition
end
foo(a,b,0.1)
The first two arguments match but not the last one.
Adriel
2
They are arrays of Int
s. Define your method as
function foo(a::AbstractVector, b::AbstractVector, c)
#definition
end
or just
function foo(a, b, c)
#definition
end
You won’t lose any performance and things will just work.
5 Likes
Or use a parametric method
a=[1,2,3]
b=[3,2,1]
function foo(a::Array{T,1}, b::Array{T,1}, c) where {T}
#definition
end
foo(a,b,0.1)