On Friday, October 16, 2015 at 1:55:19 PM UTC-4, Andras Niedermayer wrote:
>
> You can also use `map`, which is better at type inference:
>
> julia> M=10
> 10
>
> julia> [[i] for i=1:M]
> 10-element Array{Any,1}:
>

As usual, type inference is much better if you don't run it in global scope 
(that's why your "map" example worked better):

julia> *f(M) = [[i] for i=1:M]*

f (generic function with 1 method)


julia> *f(10)*

10-element Array{Array{Int64,1},1}:

 [1] 

 [2] 

 [3] 

 [4] 

 [5] 

 [6] 

 [7] 

 [8] 

 [9] 
 [10] 

Reply via email to