If you execute this in a function, or in a script file, this won’t happen.
The problem when doing it in the REPL is that Julia can’t know what you
will do with the list variable in the future, so it has to be very
defensive with type inference, to avoid having to throw nasty type errors
later.
// T
On Friday, October 16, 2015 at 4:19:54 PM UTC+2, Thuener Silva wrote:
I want to create an array of arrays of int64. But sometimes the type change
> to Any, why? It is a bug?
>
> julia> M = 10
> julia> typeof(M)
> Int64
>
> julia> list = [[i] for i=1:M]
> 10-element Array{Any,1}:
> [1]
> [2]
> [3]
> [4]
> [5]
> [6]
> [7]
> [8]
> [9]
> [10]
>
> list = [[i] for i=1:10]
> 10-element Array{Array{Int64,1},1}:
> [1]
> [2]
> [3]
> [4]
> [5]
> [6]
> [7]
> [8]
> [9]
> [10]
>
> Grats,
> Thuener Silva
>
>