by Iwan-Zotow · 6y ago · 0 comments
They decided on sequence range [1...N], instead of [0...N) like Python.
Try to compose that.
I work with both and I never found this a big problem. This is on par with complaining about whitespace in Python. I prefer languages to not be whitespace sensitive but it is not a big problem.
Although I pretty sure you will accidentally get more problem from Python whitespace usage than from Julia 1-based indexing.
And frankly since Julia can use any indexing, you can use A[begin:end] to refer to the whole range of an object. If you want the second item in any array you can just write A[begin+1].
For me, Julia people don't get range/sequence composition right, so ...
Julia's sequences/arrays are monoids too, I don't see what it has to do with anything.
read my statement again, it is about open vs closed interval. Python ranges/sequences are composable, Julia ones are not.
> Julia's sequences/arrays are monoids too
really?
suppose you compute sum, and got two results: S(1, M) and S(M, N)
Could you compose them in Julia?
For matrices and vectors, usually. For series and sequences 0-based comes up quite often too.
That's not really true in my experience, since all the nice properties of zero-based indexing transfer perfectly over to mathematics.
But you're right, this isn't anything to abandon an otherwise wonderful language over.
Because Julia is composable the shape of the array and the values in it are orthogonal while reaming performant (as discussed by the article). As demonstrated by OffsetArray how one access an array is also orthogonal to those other factors, while remaining performant (it's a zero runtime cost abstraction).