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.
Numbering should start at zero (1982)
111–120 of 309 posts
Re: Numbering should start at zero (1982)
#112Earlier quoted context omitted.
That makes sense for the ID system or a database, but for arrays in a language I still prefer starting at 0. It makes frame buffers easier easier to index
I prefer thinking from the first principles, and not according to the current computer architecture fashion. And BTW that ID system was used in the system processing PBs of data in realtime per day back in the early 2000s, so it’s not that it was super-inefficient.
Re: Numbering should start at zero (1982)
#113Earlier 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)
#114Earlier quoted context omitted.
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.
“serious discussion” notwithstanding, I thought the “u’re” was particularly interesting. Why not “ur”? “u” is obviously easier to write, so why worry about properly contracting it? Just interesting imo
Re: Numbering should start at zero (1982)
#115"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration." — Stan Kelly-Bootle
Re: Numbering should start at zero (1982)
#116"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration." — Stan Kelly-Bootle
In computer programming we often only need the position of the gap to the left, though, so calling it "the rail that starts at x=0" works. Calling it "the rail that ends at x=1" is alright, I guess, if that's what you really want, but leads to more minus ones when you have to sum collections of things.
Re: Numbering should start at zero (1982)
#117Start from 0 if you are counting boundaries (fenceposts, memory addresses)
Start from 1 if you are counting spaces (pages in a book, ordinals)
Floors are a case where both make intuitive sense, which is maybe how we ended up with European vs American floor numbering.
Re: Numbering should start at zero (1982)
#118Numbering 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.
hardly. this is an informal internet forum of mostly anonymous people chit chatting about random stuff instead of working.
Re: Numbering should start at zero (1982)
#119The 1980s were not a particularly enlightened time for programming language design; and Dijkstra's opinions seem to carry extra weight mainly because his name has a certain shock and awe factor. It isn't usual for me to agree with the mathematical convention for notations, but the 1st element of a sequence being denoted with a "1" just seems obviously superior. I'm sure there is a culture that counts their first fing…
So you claim this is just an appeal to authority and as a rebuttal you give appeal to emotion without being an authority at all?
> the 1st element of a sequence being denoted with a "1" just seems obviously superior
> I'm sure there is a culture that counts their first finger as 0 and I expect they're mocked mercilessly for it by all their neighbours
> 0-counting sequences represents a crazy choice
5G chess move.
Re: Numbering should start at zero (1982)
#120Pretty much any algorithm that involves mul/div/mod operations on array indexes will naturally use 0-based indexes (i.e. if using 1-based indexes they will have to be converted to/from 0-based to make the math work). To me this is a far more compelling argument for 0-based indexes than anything I've seen in favor of 1-based indexes.