2 ms·
Every language for scientific computation uses 1-based indexes, to follow the tradition of using them in formulas. FORTRAN, APL, Julia, R, MATLAB, GNU Octane, e
by nine_k 3y ago
Every language for scientific computation uses 1-based indexes, to follow the tradition of using them in formulas. FORTRAN, APL, Julia, R, MATLAB, GNU Octane, etc.
I remember that (some versions of) BASIC back in the day had an option to switch between 1-based and 0-based indexing, to appeal to both Fortran and C folks.
- Y_Y 3y agoIn physics, relativists usually count from 0. Furthermore on the numerical side, C is at least as popular as Fortran. Julia lets you switch the index base too. Finally a special mention for Mathematica, which appears to be 1-based, but in fact is a thinly disguised 0-based lisp, {a,b} is just List[a,b] is really just (List a b) so of course if you want b you ask for element 2, element 0 is the head and is just List.
- frozenport 3y agoNumpy