@BLI wrote:
I’m playing around with a function where the argument should be a vector of same-sized vectors, i.e.,
v = [v1,v2,v3,...,vN]
where
v1
, …,vN
etc. are vectors containing scalar elements, and of the same size.How can I test for this in the function call? I tried with:
function myfunc(v::Vector{Vector{Number}}) ... end
but that didn’t work. [And it wouldn’t even have checked that the elements of
v
were vectors of the same size…]Question:
- Is there a way to specify the structure of the argument I expect?
- Would it be better to just forget about asserting the argument type, let misuse of the function lead to an error message, and “force” the user (i.e., myself) to re-read the documentation?
Posts: 8
Participants: 3