Thank you.
However, my problem is that t(x) does not have to have type T.
And this is exactly the question - how to determine type of t(x) given that
we know that x has type T.
On Monday, November 14, 2016 at 12:29:56 AM UTC+1, Ralph Smith wrote:
>
> Until the issue with generators is resolved, this may suffice:
>
> f2x{T}(t::Function,a::AbstractArray{T})::Dict{T,T} = Dict((x,t(x)) for x
> in a)
>
>
> I think that diverts all the ambiguities to checks by conversion methods.
>
> On Sunday, November 13, 2016 at 11:16:20 AM UTC-5, [email protected]
> wrote:
>>
>> I have the folowing questions:
>>
>> 1. Why when f2 is used as written above the return type is not
>> Dict{Float64,Float64} (like in the case of f1 where it is
>> Array{Float64,1})?
>> 2. How to fix f2 so that Julia can infer the return type?
>> 3. Is there a way to change f2 so that first empty Dict{<element type
>> of a>,<element type of t(a)>}() variable is created, where <element
>> type of a> and <element type of t(a)> are determined based on the
>> passed arguments, and only next this dictionary is populated with data?
>>
>>
>>