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'.
Numbering should start at zero (1982)
91–100 of 309 posts
Re: Numbering should start at zero (1982)
#92Numbering 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.
Re: Numbering should start at zero (1982)
#93Earlier quoted context omitted.
No, it doesn't, it prints ['D', 'C']. I agree that it should be ['C', 'B'] - the way that Python handles negative `step` values is wrong.
I don't think it's "wrong" per se - it's zero-based indexing and ranges are consistently inclusive of start, exclusive of end. But, it breaks the "fence-post" mental model that some people use, and is less intuitive than MatLab's indexing approach IMO.
I do. I think it only makes sense for ranges to be inclusive at the lower end and exclusive at the higher end. A slice with a negative step `-n` should contain the same elements as the same slice as with step `n`, just reversed.
Re: Numbering should start at zero (1982)
#941-based numbering is nonsense. How many years old are you when you’re born? I notice almost all defenses of 1-based indexing are purely based on arbitrary cultural factors or historical conventions, e.g. “that’s how it’s done in math”, rather than logical arguments.
> How many years old are you when you’re born? You have lived zero full years and are in the first year of your life. In most (but not all) countries the former is considered "your age". That's consistent with both zero-based and one-based indexing. Both agree on cardinal numbers (an array [1, 2] has length 2), just not on ordinal numbers (whether the 1 in that array is the "first" or "zeroth" element). > I notice al…
I think whenever people say "zeroth" they speak in jest and doubt that there is any disagreement on the fact that the element without predecessor (nowadays in programming most often assigned index 0) is the first element.
You used "first" in that sense naturally just in the sentence before without the slightest notion of ambiguity.
You have lived zero full years and are in the first year of your life.
What people wrongly get riled up with is the fact that ordinal (first) is not in sync with the cardinal (index 0), but it rarely is anyways. If you go to an administrative office and pull your number 5357 no one assumes that there are 5356 people in the queue before them. Your are still the 5th or 10th in line, even if your index is 5357.
Re: Numbering should start at zero (1982)
#95Earlier quoted context omitted.
American elevators are 1-indexed!
at the whitney art gallery (nyc), the ground floor is 1, but the basement is -1. there's no 0 in between it bothers me way more than it should. i have to tell myself that the point of art is often to evoke emotions, and the rage i feel is included in that
Re: Numbering should start at zero (1982)
#96Behold, the really stupid things you can do in Javascript:
let myArr = [];
let index = 0;
myArr[--index] = 5;
console.log(myArr.length); // 0
console.log(myArr[index]); // 5Re: Numbering should start at zero (1982)
#97Earlier quoted context omitted.
It's interesting how most people find learning 0-based indexes confusing, but after a few years of programming, they don't even notice how odd it is. How do you number things in real life? If you have two options, do you number them "option 0" and "option 1" or "option 1" and "option 2"? If you create a presentation with numbered bullet points, do you start numbering them from 0 or 1? 1. This is my first point 2. Thi…
It's only weird in certain cultures. For example, it's common in Germany to start counting at zero. "Null, eins, zwei.."
(The first element in this list, however, is zero, and the second is one. Germans use one-based indices, just like Americans, even though they sometimes start counting from zero.)
Re: Numbering should start at zero (1982)
#98Numbering 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.
Re: Numbering should start at zero (1982)
#99Earlier quoted context omitted.
It's interesting how most people find learning 0-based indexes confusing, but after a few years of programming, they don't even notice how odd it is. How do you number things in real life? If you have two options, do you number them "option 0" and "option 1" or "option 1" and "option 2"? If you create a presentation with numbered bullet points, do you start numbering them from 0 or 1? 1. This is my first point 2. Thi…
You are just citing cultural factors like how we happen to do things in the English language, not any logical argument.
Re: Numbering should start at zero (1982)
#100I 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…