Thanks makes sense.

On Monday, 29 December 2014 18:56:54 UTC+11, [email protected] wrote:
>
> Because diff is computed with a comprehension which is typed by inference. 
>  Thats ok for a concrete type like Float64, but when faced with an abstract 
> type like Real, inference currently says its all too hard and goes for Any. 
>  See also https://github.com/JuliaLang/julia/issues/7258.
>
> Cheers
> Lex
>
>
>
> On Monday, December 29, 2014 5:29:12 PM UTC+10, [email protected] wrote:
>>
>> Would someone be able to explain why `diff()` returns Any when its input 
>> is a vector of `Real` values but returns Float64 when its input is a vector 
>> of `Float64` values?
>>
>> julia> diff(Real[1., 2.])
>>
>> 1-element Array{Any,1}:
>>
>>  1.0
>>
>> vs
>>
>> julia> diff(Float64[1,2])
>>
>> 1-element Array{Float64,1}:
>>
>>  1.0
>>
>>
>> julia> versioninfo()
>>
>> Julia Version 0.3.3
>>
>> Commit b24213b* (2014-11-23 20:19 UTC)
>>
>> Platform Info:
>>
>>   System: Darwin (x86_64-apple-darwin14.1.0)
>>
>>   CPU: Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz
>>
>>   WORD_SIZE: 64
>>
>>   BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY Haswell)
>>
>>   LAPACK: libopenblas
>>
>>   LIBM: libopenlibm
>>
>>   LLVM: libLLVM-3.3
>>
>> Thanks
>>
>

Reply via email to