Le mardi 18 août 2015 à 06:04 -0700, Michele Zaffalon a écrit : > Are `collect(a:b)` and `collect(range(a, b))` supposed to give the > same results? Does the following make sense? > > > julia> typeof(NaN:5) > FloatRange{Float64} > > julia> collect(NaN:5) > 0-element Array{Float64,1} > > julia> typeof(range(NaN, 5)) > FloatRange{Float64} > > julia> collect(range(NaN, 5)) > 5-element Array{Float64,1}: > NaN > NaN > NaN > NaN > NaN > > This is on 0.4.0, commit 6becc96 on Windows 7 64 bit. > michele The difference isn't in collect(), it's in the creation of the range. range() expects a length as its second argument, while the colon syntax takes the end value instead. So you're not creating the same range at all.
BTW, you can use dump() to see the fields of the created range, which allows you to check what's actually created. Regards