I am a biologist with no knowledge in programing. I recently started to 
write small bits of code to analyze gene co-expression networks. By the 
way, congratulations to those who developped Julia and the many available 
packages. It's really great and fairly easy to make simple things in a 
matter of days with the intuitive Julia syntax.

I am not familar with type management in programing languages but some 
behaviors are puzzling for a tenderfoot like myself. Here is a piece of 
stupid code just to illustrate my question (I'm using JuliaStudio):

julia> A=[1,2] 

2-element Array{Int64,1}:

 1

 2


julia> typeof([A[1]]) 

Array{Int64,1}


julia> typeof([A[i] for i=1])
Array{Any,1}

Of course int() is doing the job.

julia> typeof(int([A[i] for i=1]))
Array{Int64,1}

Yet, I find this behavior strange and using int(), float()... makes the code 
unnecessarily heavy.
I looked through the posts on julia-users but could not find information about 
how to avoid type change during comprehension. Any advice ?


Reply via email to