6 ms·
You mean, the little ant on the floor? I barfed at 1-based indexing for about a week, but now it is as natural as anything. I would compare 0-based and 1-base
by JuettnerDistrib 5y ago
You mean, the little ant on the floor?
I barfed at 1-based indexing for about a week, but now it is as natural as anything.
I would compare 0-based and 1-based indexing with whether you put semicolons at the end of each line or not. Either way doesn't really change the feel (semantics) of the language.
Also, fortan is 1-based, iirc, and a lot of numerical code is in fortan.
Oh, and many many beginning programmers and scientists have a hard time with 0-based indexing. Not sure why, but such you hear, so the choice is really not that odd.
- dash2 5y agoThe reason beginners have a hard time with 0 based indexing is that humans count from 1. Seriously, I've spent weeks trying to tell people "yeah, we want rows 4 and 5, so that's, uh, rows 3 and 4..." and they think it's nuts, and I now think they're right.
- deleted 5y ago[deleted]
- goerz 5y agoRight. Zero based indexing makes zero sense, unless you explain the underlying technical reason, that it’s an offset relative to a memory pointer (spend a week teaching pointers first!). It makes sense in certain context (and in languages like C that have a low-level mental model). For scientific computing at a higher level of abstraction where the mental model of a multidimensional array is a tensor, and not a memory offset location, zero-based indices really get in the way
- ChrisRackauckas 5y ago> Zero based indexing makes zero sense The sensibility of the index choice is equal to the starting value of the index.
- jonniedie 5y agoStarWars indexing makes 4 sense.
- ChrisRackauckas 5y agoyupyupyup, you got it. :)
- hpcjoe 5y agoPrecisely. Indexing makes sense in a context, and it is trivial in general to switch. This said, telling people that the first element they want is the "0th", is completely unnatural.