I would appreciate if someone could help me understand this. I know that in Julia you don’t have to specify types of function arguments. But if possible, I want to do it because it helps me understand the code more easily.
I defined a function with one of the arguments being a dictionary of type
Dict{Tuple{Number, Number}, Number}
. When I explicitly create an instance of this argument (using numerical values) Julia assigns that value the type Dict{Tuple{Int64, Int64}, Float64}
. When I pass this value to the function I get the following error (please see argument number 3). Since both Int64
and Float64
are subtypes of Number
, I thought this should work. Where am I going wrong?
Interestingly, no such error is thrown for the first two arguments.
ERROR: MethodError: no method matching exp_payoff(::Tuple{Int64,Int64}, ::Int64, ::Dict{Tuple{Int64,Int64},Float64}, ::Int64, ::Int64, ::Set{Tuple{Int64,Int64}}, ::Distributions.Poisson{Float64}, ::Distributions.Poisson{Float64}, ::Distributions.Poisson{Float64}, ::Distributions.Poisson{Float64}, ::Float64)
Closest candidates are:
exp_payoff(::Tuple{Number,Number}, ::Number, ::Dict{Tuple{Number,Number},Number}, ::Number, ::Number, ::Any, ::Distributions.Poisson, ::Distributions.Poisson, ::Distributions.Poisson, ::Distributions.Poisson, ::Any)