Why is Base.OneTo(n)
faster than 1:n
(in indexing), I read that the lower bound is guaranteed (by the compiler) to be 1, but I don’t get How ? and Why isn’t 1:n
’s lower bound guaranteed to be 1 ? and why don’t the julia developpers make colon(1, n)::Base.OneTo(n)
Base.OneTo(n)
is known from its type to start at 1
. 1:n
cannot from its type be known to start at 1 (it has the same type as 2:n
).
It would be bad if 1:n
and 2:n
had different types.
5 Likes