4 ms·
Math uses base 1, and so does Fortran and Matlab. While Julia is an incredibly powerful language with things like user-defined unboxed structs and homoiconicity
by lenticular 8y ago
Math uses base 1, and so does Fortran and Matlab. While Julia is an incredibly powerful language with things like user-defined unboxed structs and homoiconicity, a key design goal is to make it easy to learn for scientists and engineers who are not professional programmers. Since the vast majority use Matlab, the one-based indexing makes sense.
One-based indexing works just as well as 0-based. I've done a lot in the past in Fortran 90 and (regrettably) Matlab. Some things are very slightly harder, some things are very slightly easier. At any rate, this isn't Fortran 77. You shouldn't be fiddling around with indices much.
The bigger difference IMO is Julia uses Fortran-style column-major ordering, instead of row-major like C and Python. I actually