I’ve looked at this question on the Julia discourse and checked parametric types in the docs (which are fantastic docs, I’d like to add) and I’m not sure what to do next.
I have a function which wants tuples of numbers, making sure to specify <:Real
instead of just Real
:
function point_within(point::Tuple{<:Real, <:Real}, polygon::Vector{Tuple{<:Real, <:Real}})
Yet, giving it Int64s yields the following error:
LoadError: MethodError: no method matching point_within(::Tuple{Int64, Int64}, ::Vector{Tuple{Int64, Int64}})
Closest candidates are:
point_within(::Tuple{Real, Real}, ::Vector{Tuple{Real, Real}})
I’d be most grateful to know best practise for dealing with abstract parametric types and if possible, something to replace the above example of an offending function definition with.