Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The way I've thought about this is that it's about whether an index is the name or the offset of an element of an array. Indices have a torsor-like structure, where you can subtract indices i and j to get an offset j-i from index i, and there is the relationship a[j] == a[i + (j-i)]. Zero-indexing is the special case that the name is the offset from the first element.

Because of this, I figure any language that supports 1-indexing should also support arbitrary ranges for the indexing, like in Ada. (Basically, what's so special about 1?)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: