January 2020
Intermediate to advanced
532 pages
13h 31m
English
This option differs from option 3 only in the way that the types of arguments are separately specified. Thus, the function can accept different types for the first and second arguments. The function is defined as follows:
sumprod_4(A::Vector{S}, B::Vector{T}) where {S <: Number, T <: Number} = sum(A .* B)
We can try it now:

We have definitely addressed the issue with mixed argument types by now. We're getting close to the final destination. Scenario 4 is the case where the arguments are matrices rather than vectors. For sure we know how to fix this, so let's do that next. ...
Read now
Unlock full access