10 ms·
Nats start at 0, end of discussion - it's only logical to index by the naturals.
by turboponyy 4y ago
Nats start at 0, end of discussion - it's only logical to index by the naturals.
- JadeNB 4y ago> Nats start at 0, end of discussion - it's only logical to index by the naturals. Now you'll just bring out the people who start the naturals at 1.
- ajg36 4y agoStarting the naturals at 1 is quite onerous.
- colejohnson66 4y agoThat’s why I compromise and start at -1
- topaz0 4y agoIf there were any justice in the world, they'd start at 2, as a handicap. They might even make it out of the bottom of the NL east if that was the case.
- salty_biscuits 4y agoWhere 0 is the cardinality of the empty set, i.e. some empty collection. Not a convincing argument.
- JadeNB 4y ago> Where 0 is the cardinality of the empty set, i.e. some empty collection. Not a convincing argument. Why not? "Every cardinality, except of the empty set, is a natural number" isn't very convincing to me, if we're making cardinal-based arguments.
- thaumasiotes 4y agoIt's not a convincing argument because you index into an array if you want to retrieve an element contained in the array. If 0 is the cardinality of an empty collection, it's not a valid index, because you can only index into non-empty collections.
- JadeNB 4y agoDijkstra's argument (https://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF https://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF) is that the index counts the number of predecessors. I think an age-based way to phrase it: in your 1st year, your age is 0; in your 2nd year, your age is 1; and so on. We can assign people numbers indicating what year of their lives they're in, or how many years they have lived, and both are fine, but we've settled on the latter.
- thaumasiotes 4y ago> Dijkstra's argument (https://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF https://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF) is that the index counts the number of predecessors. That's not an argument. It's a coincidence. There are applications where what you care about is the number of predecessors (indeed, that's what the compiler cares about, which is why we have 0-indexing in the first place), but they are a tiny minority of all indexing. > I think an age-based way to phrase it: in your 1st year, your age is 0; in your 2nd year, your age is 1; and so on. But that isn't even true. No one ever reports the age of their new child as 0; instead, they will report a positive number of months, or -- if it's an extremely new child -- of weeks or days.
- JadeNB 4y ago> That's not an argument. It's a coincidence. There are applications where what you care about is the number of predecessors (indeed, that's what the compiler cares about, which is why we have 0-indexing in the first place), but they are a tiny minority of all indexing. I think there's nothing to say to the first two sentences but that I regard it as an argument that may be more or less convincing. I don't know exactly what it means for something to be an argument vs. a coincidence; it is a coincidence that, say, my name is what it is, but it is nonetheless correct for me to argue that that is my name. These are all conventions anyway, and there is not much use (or even meaning) in arguing about which one is the right or wrong convention, just which one makes more or less sense; and this is one way to make sense of 0-based indexing, though of course there are also ways to make sense of 1-based indexing. I'm not sure I buy that these cases are a tiny minority, but I'm certainly in no position to produce any data to the contrary. > > I think an age-based way to phrase it: in your 1st year, your age is 0; in your 2nd year, your age is 1; and so on. > But that isn't even true. No one ever reports the age of their new child as 0; instead, they will report a positive number of months, or -- if it's an extremely new child -- of weeks or days. I can believe that ages aren't reported that way, although I think that a child who will be 1 year in 1 year should logically be said to be 0 years; but we can avoid that debate by considering future years: in, to pick the example that applies to me, my 42nd year of life, I am 41 (I could say 41 and 1 month, but I don't—in fact, there's a Seinfeld joke about that). Similarly, the 42nd entry in a 0-indexed array is indexed 41. It doesn't have to be that way, but I don't think one can argue that there's anything logically amiss about it (nor about 1-based indexing … but we do have to pick one).
- mtizim 4y agoThat's really silly - the natural numbers also famously start at either 0 or 1, depending on the country, the discipline, and the individual.
- thaumasiotes 4y agoI like to treat the naturals as starting at zero, but not for any mathematical reason. I just think that since it's easy to write ℤ+, it's more useful for ℕ to refer to something slightly different than it would be for ℕ to be a synonym for ℤ+ while anyone wanting to include zero in their set was forced to spell out "nonnegative integers". A dichotomy between "ℤ+" on the one hand versus "ℕ" on the other is just plain more convenient than a dichotomy between "ℤ+" and "ℕ" on the one hand versus "ℤ\ℤ-" on the other.
- zzo38computer 4y agoIt is because you mean two different things by "natural numbers", even though the same words are used for things that are not the same things. I prefer to start by zero; I think it is more useful in general, and makes more sense mathematically for many (although not all) purposes, and systems that you will find objects and operations that have these properties too.
- thaumasiotes 4y ago> Nats start at 0, end of discussion - it's only logical to index by the naturals. Well, no, obviously you want to index by ordinals, and they start at "first".
- smugma 4y agoI learned them in elementary school (in the US) as starting at 1. Indeed, Google's first result for natural number is from Oxford Languages, and defines natural number as: the positive integers (whole numbers) 1, 2, 3, etc., and sometimes zero as well.
- lttlrck 4y agoother important and day to day tools like rulers, clocks and speedometers also start at zero. So it's not exactly "bending humans to microprocessors weird alien ways". It all makes perfect sense in the context of measuring.
- foobarbaz33 4y agoThe analogy is slightly off though. The first position of an array occupies 1 unit of memory. 0 is not a possible measurement in the world of arrays. Maybe a null terminated string could have length 0 if you don't count the terminator. But that 0 is a property of the "string" abstraction. The actual "array" would still be length 1.
- iopq 4y agoAn array of length 0 starts at 0 and ends with 0
- foobarbaz33 4y ago> An array of length 0 starts at 0 and ends with 0 Nope. The moment you "start" somewhere you occupy 1 unit of memory. Thus no longer an "array of length 0". There is no such thing as an array of length 0. It absolutely does not exist. You cannot write source code to represent it. ie assuming we are talking about the pure data structure of an array. Some languages may have some abstraction built on of arrays (ie c-strings) that can have length 0 but these are not "arrays" and if they are defined they still occupy 1 unit of memory for the terminator.