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?

Reply via email to