4 ms·
>It's the difference between numbering the contents of the list (1 indexing), and measuring the distance from the beginning of the list to the start of the item
by coldtea 8y ago
>It's the difference between numbering the contents of the list (1 indexing), and measuring the distance from the beginning of the list to the start of the item (0 indexing).
The problem is that one is indeed an indexing (numbering the contents 1...X...N and asking for item X, customers[X]), whereas the other is not, but is used as an indexing (e.g. customers[5] is not getting the 5th item but the sixth).
- Twisol 8y agoWhere does your definition of "an indexing" originate? The word "index" literally means "to point at" (hence, index/pointer finger), and in this sense, every element may indeed be indexed -- in this case, by means of a unique integer. If I had to give a name to the concept you're talking about, it would be an "ordinal index".
- coldtea 8y ago>If I had to give a name to the concept you're talking about, it would be an "ordinal index". Which is both the naive understanding of a numeric index in everyday life in general, and the most common case in mathematics (and most math/scientific software).
- e12e 8y agoIndex finger, or first finger, right next to the zeroeth finger, the thumb... ;)
- vvillena 8y agoIn 1-based arrays the number is an index, but in 0-based arrays it is an offset. Languages like C or Rust make this behavior very explicit.