4 ms·
One can make an appeal to aesthetics, but that’s no differentiator. Or one could appeal to adherence to existing standards. Fortran is the oldest (portable) pr
by peatmoss 9y ago
One can make an appeal to aesthetics, but that’s no differentiator.
Or one could appeal to adherence to existing standards. Fortran is the oldest (portable) programming language and was 1-based.
Or one could appeal to consistency with the problem domain. Again, math [EDIT: indices are] 1-based.
Zero-based is consistent with C, but that’s about the best argument I can make for zero-based.
- DonbunEf7 9y agoMaths is zero-based. I'm not sure why you think that numbers start with one; every formulation of the integers in modern maths starts with zero.
- peatmoss 9y agoMatrices, common in statistics because of applications of linear algebra, have long maintained the convention of i,j indexes starting with one.
- dnautics 9y agoIt's not. Zero based is wise for offsets (CS) and fields where you have a zero element, and a few corner cases like factorial, but by and large any time you're enumerating an order over a nonempty set you start with one in math, because, max(indices) = |set|
- billfruit 9y agoI think Dijkstra established the case for using Zero based indexing strong enough: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/E...