My guess is that this has something to do with currently lacking facilities for type inference on global variables. If you wrap your indirect approach in a function, you get the predictable behavior:
julia> function f() xvals = [ d for d in 1.0:10.0 ] xxvals = [ (d,d) for d in xvals ] return xxvals end f (generic function with 1 method) julia> f() 10-element Array{(Float64,Float64),1}: (1.0,1.0) (2.0,2.0) (3.0,3.0) (4.0,4.0) (5.0,5.0) (6.0,6.0) (7.0,7.0) (8.0,8.0) (9.0,9.0) (10.0,10.0) On Wednesday, May 13, 2015 at 7:44:26 AM UTC-4, cormu...@mac.com wrote: > > Currently having a mental block about this here. Why does this code: > > julia> [(d,d) for d in 1.0:10.0] > 10-element Array{(Float64,Float64),1}: > (1.0,1.0) > (2.0,2.0) > (3.0,3.0) > (4.0,4.0) > (5.0,5.0) > (6.0,6.0) > (7.0,7.0) > (8.0,8.0) > (9.0,9.0) > (10.0,10.0) > > produce an array of floats, but this less direct version: > > julia> x_vals = [d for d in 1.0:10.0] > 10-element Array{Float64,1}: > 1.0 > 2.0 > 3.0 > 4.0 > 5.0 > 6.0 > 7.0 > 8.0 > 9.0 > 10.0 > > julia> [(d,d) for d in x_vals] > 10-element Array{(Any,Any),1}: > (1.0,1.0) > (2.0,2.0) > (3.0,3.0) > (4.0,4.0) > (5.0,5.0) > (6.0,6.0) > (7.0,7.0) > (8.0,8.0) > (9.0,9.0) > (10.0,10.0) > > produces an array of Any? >