Hi,
I'm trying to write a function that accepts a vector of values that are of
the same (overall) type but with different parameterisations. As a simple
example, consider the vector = [Dict("a"=>1), Dict("b"=>1.0)]. I can easily
use a function along the lines of
function myfunc(vec::Vector{Dict})
# do something
end
but I'd like to be able to restrict the parameterisation slightly so that
the first parameter of the Dict type is an ASCIIString (not my actual use
case but follows exactly the same pattern). I've tried doing something like
function myfunc{T}(vec::Vector{Dict{ASCIIString, T}})
# do something
end
but this seems to enforce the condition that all the Dicts in the vector
have the same parametric type T (so my example of myfunc([Dict("a"=>1),
Dict("b"=>1.0)]) fails). Is there any way of expressing this constraint? Or
will I just have to use the first form of myfunc with some extra checking
in the function body?
Thanks
David