3 ms·
Why limit yourself to zero or one? Julia now lets you use any start point you'd like. A fairly recent change, so you might have missed it. http://docs.juliala
by rrock 10y ago
Why limit yourself to zero or one? Julia now lets you use any start point you'd like. A fairly recent change, so you might have missed it.
http://docs.julialang.org/en/latest/devdocs/offset-arrays/ http://docs.julialang.org/en/latest/devdocs/offset-arrays/
- dekhn 10y agoThe problem is that I maintain other people's code, and I don't want the language to add all those extra things. It's a big cognitive load to maintain, and leads to bugs in production software that is hard to debug. The julia docs mention that Fortran arrays can be indexed with various starting numbers. I've programmed and maintained millions of lines of Fortran over 20 years and I've never seen anybody use anything other than 0 as the starting index.
- ffriend 10y agoFortran, Mathematica, Matlab, R, Lua - all start indexing from 1 (you can find an incomplete list in [1]). For users coming from these languages (which is a large part of the Julia community) the cognitive load would be in the opposite direction. [1]: https://en.wikipedia.org/wiki/Comparison_of_programming_languages_%28array%29#Array%5Fsystem%5Fcross-reference%5Flist https://en.wikipedia.org/wiki/Comparison_of_programming_lang...
- dekhn 10y agoI suspect the number of C++/Python or Python/Fortran (where users use 0-based indexing) programmers is larger than Fortran +Math +Matlab + R + Lua. Anyway, I'm not defending my decision as a globally correct one- it only matter to me.
- deleted 10y ago[deleted]