I have a famility of functions
b(t, x::T) =
called in a loop
for i in 1:n
t = t + dt
x = x + dt*f(t, x)
end
It turns out that sometimes I’d need the index i
as well and I’d like to define
f((i,s)::Tuple, x) = f(s, x)
for i in 1:n
t = t + dt
x = x + dt*f((i,s), x)
end
Which creates ambiguity between all my f(s, x::T)
and f((i,s)::Tuple, x)
. Of course I could
play with the order of the arguments or use a different function name but just to be sure: is there a way do define
f((i,s)::Tuple, x) = f(s, x)
such it has higher priority than (say)
f(s, x::Float64)
but less than f((i,s)::Tuple, x::Float64)
?