Live data from Hacker News

Numbering should start at zero (1982)

cs.utexas.edu

221–230 of 309 posts

Re: Numbering should start at zero (1982)

#221

Numbering should start at π (2025) (umars.edu) Seriously, it all depends on whether u're counting the items themselves (1-based) or the spaces btwn them (0-based). The former uses natural numbers, while the latter uses non-negative integers For instance, when dealing with memory words, do u address the word itself or its starting location (the first byte)? The same consideration applies to coordinate systems: r u pos…

Why do you write “you” as “u” here? I don’t want to be rude, but it’s very jarring to see juvenile txt-speak in a serious discussion.

maybe on a mobile?

Re: Numbering should start at zero (1982)

#222
post #186

Earlier quoted context omitted.

Sam Altman: https://x.com/sama

I knew who it was, sorry, I was just trolling. Both twitter and AI-bro culture are extremely distasteful to me so I thought citing an AI bro’s twitter account as an example of how it’s acceptable to behave online was absurd.

Ah. I took it to be less "sama did it, so it's OK," and more "you wouldn't gatekeep sama's English, so why gatekeep the English of a random HN commenter?" But maybe that was the wrong interpretation.

Re: Numbering should start at zero (1982)

#223

Perhaps ideally we'd change English to count the "first" entry in a sequence as the "zeroth" item, but the path dependency and the effort required to do that is rather large to say the least. At least we're not stuck with the Roman "inclusive counting" system that included one extra number in ranges* so that e.g. weeks have "8" days and Sunday is two days before Monday since Monday is itself included in the count. *…

A day needs to finish before you count the next one. It makes perfect sense.

Re: Numbering should start at zero (1982)

#224

Earlier quoted context omitted.

Your arguments using "first" and "second" are invalid, because those words have nothing to do with numbers, like also "last". If you argue based on English, you should point only to the ordinals "third", "fourth" and the like. In the older European languages, the initial position in a sequence was named using words like "first", which mean "closest to the front". The next position was named with words meaning "the ot…

> Your arguments using "first" and "second" are invalid, > because those words have nothing to do with numbers "First" is the ordinal number corresponding to the number one, while "second" is the ordinal number corresponding to the number two. You can represent "first" as 1st and "second" as 2nd. I believe the origins of these two words do not significantly impact my argument.

Nothing in the word "first" indicates that it corresponds to "one". The same for "second". Those words are not numerals, "first" is a superlative adjective, while "second" is an active participle. They are perceived as ordinal numerals only because English does not have ordinal numerals for the 2 initial positions of a sequence and "first" and "second" are used instead of the missing ordinal numerals.

The abbreviations "1st" and "2nd" are very recent and they cannot be used as an argument that there is a long tradition of correspondence between "first" and "one".

Like I have said, the correct argument based on English is that the position after the second is called "third", which is derived from "three", and the next position is called "fourth" from "4", so extrapolating backwards that sequence results in decrementing "3", which gives a correspondence between "2" and "second", and decrementing the number once more gives a correspondence between "1" and "first".

This is the exact reasoning that has lead to the abbreviations "1st" and "2nd", which have no relationship with the pronunciation or the meaning of the abbreviated words, which mean "closest to the front" and "the following", meanings that are unrelated to any numbers.

Re: Numbering should start at zero (1982)

#225
post #13
post #11

I found it devastating that there are no distinct agreed-upon words denoting zero- and one-based addressing. Initially I thought that the word "index" clearly denotes zero-base, and for one-base there is "order", "position", "rank" or some other word, but after rather painful and humiliating research I stood corrected. ("Index" is really used in both meanings, and without prior knowledge of the context, there is real…

I humbly submit '1ndex' and 'ind0x', or '1dx' and 'i0x'.

Pronounced "one-dex" and "in-dox"?

Re: Numbering should start at zero (1982)

#228
post #171

Earlier quoted context omitted.

I always thought: - Offset: 0-based - Index: 1-based

That sounds reasonable at first, but humans are messy and so the distinction is not always clear. For example, in music we use numbers for the notes of a scale (G is the 5th of C, because in the C major scale: C=1, D=2, E=3, F=4, G=5, A=6, B=7). The numbers are clearly indices for the notes of the scale. But we often think of stuff like: what's the 3rd of the 5th -- that is, get the note at the 5th position (G in our…

Yeah, because the scale is an index (e.gm A=6) but the operations are offsets in that case. Because if you moved from G/5 to B/7 that is clearly 2.

Re: Numbering should start at zero (1982)

#229

Perhaps ideally we'd change English to count the "first" entry in a sequence as the "zeroth" item, but the path dependency and the effort required to do that is rather large to say the least. At least we're not stuck with the Roman "inclusive counting" system that included one extra number in ranges* so that e.g. weeks have "8" days and Sunday is two days before Monday since Monday is itself included in the count. *…

> At least we're not stuck with the Roman "inclusive counting" system that included one extra number in ranges* so that e.g. weeks have "8" days and Sunday is two days before Monday since Monday is itself included in the count.

Yes, we are. C gives pointers one past the end of an array meaningful semantics. That's in the standard. You can compare them and operate on them but not de-reference them.

Amusingly, you're not allowed to go one off the end at the beginning of a C or C++ array. (Although Numerical Recipes in C did it to mimic FORTRAN indices.) So reverse iterators in C++ are not like forward iterators. They're off by 1.

[1] https://devblogs.microsoft.com/oldnewthing/20211112-00/?p=10...

Re: Numbering should start at zero (1982)

#230

Earlier quoted context omitted.

-1 is correct, there is no -0. The math works correctly the Python way.

Indexing is not really math, it's a reference-system which is using numbers for convenience. You could use letters or even emojis to get the same result.

[closed, open) intervals on the number line are well-known in math, as are operations on them. -0 is not, nor supported by hardware.
Post reply on HN