Re:Why do arrays start at 0?
by mtizim on Wednesday August 24, 2022 @05:31PM
(#32586051)
That's really silly - the natural numbers also famously start at either 0 or 1, depending on the country, the discipline, and the individual.
[ Parent
| on HN ]
Re:Why do arrays start at 0?
by thaumasiotes on Wednesday August 24, 2022 @06:04PM
(#32586392)
I 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.
Re:Why do arrays start at 0?
by zzo38computer on Wednesday August 24, 2022 @06:47PM
(#32586860)
It 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.