# So, ranges are a thing:
julia> 1:3
1:3
# Not an obvious type, but OK:
julia> typeof(1:3)
UnitRange{Int64}
# And they can be assigned to variable, good.
julia> a = 1:3
1:3
# WAT: A warning about using collect()?
julia> a = [1:3]
WARNING: [a] concatenation is deprecated; use collect(a) instead
in depwarn at deprecated.jl:73
in oldstyle_vcat_warning at
/Applications/Julia-0.4.5.app/Contents/Resources/julia/lib/julia/sys.dylib
in vect at abstractarray.jl:32
while loading no file, in expression starting on line 0
3-element Array{Int64,1}:
1
2
3
# WAT: why would a semicolon make the error go away?
julia> a = [1:3;]
3-element Array{Int64,1}:
1
2
3
# This makes sense, I _should_ get a warning every time...
julia> a = [1:3]
WARNING: [a] concatenation is deprecated; use collect(a) instead
in depwarn at deprecated.jl:73
in oldstyle_vcat_warning at
/Applications/Julia-0.4.5.app/Contents/Resources/julia/lib/julia/sys.dylib
in vect at abstractarray.jl:32
while loading no file, in expression starting on line 0
3-element Array{Int64,1}:
1
2
3
# WAT: Third time's a charm? We have apparently beaten the interpreter into
submission :-)
julia> a = [1:3]
3-element Array{Int64,1}:
1
2
3
# By way of comparison, I recently ran some old code and discovered that {}
is no longer OK:
julia> {}
WARNING: deprecated syntax "{}".
Use "[]" instead.
0-element Array{Any,1}
julia> {}
WARNING: deprecated syntax "{}".
Use "[]" instead.
0-element Array{Any,1}
# And apparently in this case, the interpreter will insist _forever_ ...
julia> {}
WARNING: deprecated syntax "{}".
Use "[]" instead.
0-element Array{Any,1}