Thanks, that's very helpful!

David

On 15 July 2016 at 09:00, Tim Holy <[email protected]> wrote:

> julia> c = [Dict("a"=>1), Dict("b"=>2)]
> 2-element Array{Dict{ASCIIString,Int64},1}:
>  Dict("a"=>1)
>  Dict("b"=>2)
>
> julia> myfunc(c)
> ERROR: MethodError: `myfunc` has no method matching
> myfunc(::Array{Dict{ASCIIString,Int64},1})
>
> Here, Julia is complaining that your argument is too-well typed :-). (See
> invariance/covariance/contravariance in the manual.)
>
> The version I posted handles both of them.
>
> Best,
> --Tim
>
> On Thursday, July 14, 2016 9:54:08 PM CDT 'Greg Plowman' via julia-users
> wrote:
> > > What about the following?
> >
> > myfunc(vec::Vector{Dict{ASCIIString}}) = 1
> > a = [ Dict("a"=>1), Dict("b"=>1.0) ]
> > b = [ Dict(1=>:hello), Dict(2=>:world) ]
> >
> >
> > julia> myfunc(a)
> > 1
> >
> > julia> myfunc(b)
> > ERROR: MethodError: `myfunc` has no method matching
> > myfunc(::Array{Dict{Int64,Symbol},1})
>
>
>


-- 
David Barton
Office: 0117 3315613
Home: 0117 9470050
Mob: 07811 744609
Email: [email protected]
Web: www.cityinthesky.co.uk

Reply via email to