3 ms·
1 - based indexing is superior when thinking about actual collections, and not memory pointers. Most regular folks think of '1' index based. Eg. Most elevator
by ardit33 3y ago
1 - based indexing is superior when thinking about actual collections, and not memory pointers. Most regular folks think of '1' index based. Eg. Most elevators (at least in NYC) start at floor 1, not 0. Once they start CS/programing classes they adjust to 0 thinking
0 - based indexing is better when dealing with pointers. But, none of us do today, (at least directly), and it seems that 0 based indexing is just an artifact of time.
When I used Lua for professional programming, I thought that 1 - based index is just better. I saw my self doing a lot less (-1) calculations.
- ivirshup 3y ago> Most elevators (at least in NYC) start at floor 1, not 0. European buildings are generally 0-indexed: https://en.wikipedia.org/wiki/Storey#Numbering https://en.wikipedia.org/wiki/Storey#Numbering
- SoftTalker 3y agoExcept people call it the "ground" floor which makes sense, not the "zero" floor which does not.
- plugin-baby 3y ago0 makes sense when you consider -1 to be the first basement level.
- dr_kiszonka 3y agoWhich also gently introduces children to negative numbers : - )
- derriz 3y agoIt’s not consistent but I would estimate that “0” buttons are as common as “G” buttons in elevators in Europe - along with -1, -2, etc for basement levels.
- elzbardico 3y agoThe same applies to most former continental Europeans colonies in latin america and africa. 0 based indexing, sometimes with Floor 0 (argentina comes to mind) or simply ground (Terreo in Brazil)
- jaza 3y agoAustralian buildings generally have "G" for "Ground" level (or something similar), then level 1 above that, so they're basically 0 indexed.
- gsinclair 3y ago0-based also makes more sense when modular arithmetic calculations are involved, which is not that uncommon.
- jackieee 3y agoIn my building the 1st floor is on set of stairs/1 elevator ride up, the real first floor (i.e the ground floor) is labeled lobby (or a big green button in the elevator). 0-based indexing makes just a much sense at higher level abstractions, aka iterators because there you're more likely to think in distances and ranges than indices, iter.advance(0) => stay where you are, so if iter is at the start, iter+0 is the first element.
- JdeBP 3y agoWe really don't want to use U.S.A. lifts as a gold standard, unless we want array indexing that unpredictably misses out array index 13 based upon the religious beliefs of the initial software developer. (-: