I'm an expat from focusing on R for a long time where the :
(colon) operator creates integer sequences from the first to the second argument:
1:10
# [1] 1 2 3 4 5 6 7 8 9 10
10:1
# [1] 10 9 8 7 6 5 4 3 2 1
Noticing that this appears to work the same in Julia, I ran into an error:
1:10 .== 10:1
DimensionMismatch("arrays could not be broadcast to a common size")
Because:
10:1
Outputs
10:9
I'm puzzled about how this could have happened. It seems quite natural not to need to use 10:-1:1
-- why did Julia think 10:9
was the right interpretation of 10:1
?