5 ms·
Liking zero indexed lists is such a dumb programmer meme. Lists are for humans to read and therefore should use the natural numbers, which start at one. Arrays
by haburka 9y ago
Liking zero indexed lists is such a dumb programmer meme. Lists are for humans to read and therefore should use the natural numbers, which start at one. Arrays are zero indexed because the first item of the array starts with zero offset.
- zwerdlds 9y agohttps://en.wikipedia.org/wiki/Storey#Numbering https://en.wikipedia.org/wiki/Storey#Numbering
- powercf 9y ago> Lists are for humans to read and therefore should use the natural numbers, which start at one. https://en.wikipedia.org/wiki/Peano_axioms#Formulation https://en.wikipedia.org/wiki/Peano_axioms#Formulation To address the content of your post: I agree, but humans aren't purely logical devices created by Dr. Noonien Soong, and we do enjoy playing with things and joking about.
- pwdisswordfish 9y agoPeano axioms can just as well be formulated with 1 as the smallest natural number, with little consequence as to the expressiveness of the resulting theory. Not that there aren't mathematical reasons to start counting with zero, but this isn't a very strong one, at least not without further elaboration.
- femto113 9y agoEver been in an elevator in Europe?
- curun1r 9y agoAnd it's because of dumb non-programmers that we have 12am immediately following 11pm. If we were to, instead, recognize the beginning/middle of the day as 0, the am/pm transitions would be sensible. Starting at 0 is almost always correct, teaching people to start counting at 1 isn't. Why do we continually come up with convoluted workarounds simply because we educate children incorrectly?
- gbl08ma 9y agoI believe that hours going up to 12 instead of going 0 .. 11 is because you can't quite hear a bell strike zero times, no?
- dpkonofa 9y agoAlthough that's kind of a clever response, most bells have a chime to alert you to the hour change so it would just be the chime without the counted bell strikes. Better yet, since 0 would always be the start of a new day, make the strikes do some kind of awesome song.
- njharman 9y agoWat? There are 24 hours in a day 1-24 or 0-23, pick your poison. But 100% Fuck halfday, 1-12 bullshit. P.S. Also fuckoff non-UTC time.
- Spooky23 9y agoFuck hours. There's only 1440 minutes a day. No time for hour conversions.
- leesalminen 9y agoI wish we could all schedule things on UTC time. I've been part of 10 person meetings across 4 time zones and scheduling sucks. Inevitably someone assumes a meeting is scheduled in their local time.
- manyxcxi 9y agoYou don't have to be in UTC, but having your clock set to 24 hours still makes it a lot easier. After a year of daily meetings with people on the east coast (of the US), London, Hamberg, and Brasilia from the west coast of the US I just moved to 24 hours and found it much easier to mentally calculate everyone's respective times- as long as I could keep the offsets squared away. Screw daylight savings.
- wongarsu 9y ago>Lists are for humans to read and therefore should use the natural numbers Depending on who you ask, the natural numbers do contain zero. Notably ISO 80000-2 is of that opinion. In university, half my professors included 0 in the natural numbers, half excluded it. For lists, starting them at 1 makes sense, but I would argue that's purely because that way the words "first", "second", "fiftieth" etc. line up with the numbering. It has nothing to do with human consumption. For example floor numbers are made for humans too, but the European scheme of labeling floors -2, -1, 0, 1, 2, 3 makes much more sense than leaving out 0, leading to awkward -2, -1, 1, 2, 3, 4. Years are made for humans too, but most people are confused about the ordering of years because having the year -1 followed by year 1 just seems weird and makes date math difficult (for humans).
- Dylan16807 9y agoTo be fair to floor labels starting with 1, I have never seen a floor with a negative number.
- pwdisswordfish 9y agoYou haven't been around much, then. The seven-segment display inside the elevator in my former dormitory labelled the ground floor as '0', and the one below as '-1'. There was also a voice announcer, but I don't remember what it said on floor -1; I didn't go there often.
- kuschku 9y agoHours go 0:00 to 23:59 Elevators use 0 for ground floor, negative for basements, and positive for upper floors. Just two examples of zero indexed lists in real life.
- pklausler 9y agoAnd sometimes to 23:60.
- fapjacks 9y agoOh, thanks for deciding that for us.
- Hnrobert42 9y agoI like it even more now.
- joshontheweb 9y agoI found it interesting to see that building floors in Australia are zero indexed. The first floor there is what Americans would call the second. Not sure why they chose to do it that way but it works fine in the real world.
- pacaro 9y agoThe U.K. does the same. Starts with ground floor, then first
- cyphar 9y agoThat's not the case in all Australian buildings. Usually we call the ground floor "ground floor" (which you could argue is 0-indexed), and the floor above it is "the first floor". But there are a lot of buildings that follow the American style of "the ground floor is the first floor". We also don't use negative numbers, basements are prefixed with a B, so B1 is like -1.
- InitialLastName 9y agoDue to hills, many of the buildings at my American university were 2 indexed: Due to hills, the apparent ground floor was usually labeled "2nd Floor".
- inopinatus 9y agoSince we're picking all the nits and talking about definitions like the natural numbers rather than common parlance, then may I observe that sequential lists are using ordinal numbers, and the set of ordinals derived from natural numbers definitely does start with zero, in this case it being the minimum element of the ordinals of non-zero cardinality.
- _asummers 9y agoMy recollection is that arrays are zero indexed because time shared compilers were too slow to do the arithmetic shift in the compilation phase. I can't find a good citation offhand though.