Live data from Hacker News

Numbering should start at zero (1982)

cs.utexas.edu

71–80 of 309 posts

Re: Numbering should start at zero (1982)

#73

Earlier quoted context omitted.

> I suppose 1-based index is more logical Why?

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)

#74
post #58

1-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.

> 1-based numbering is nonsense. How many years old are you when you’re born? Typically 3 months shy of 1 year, so about 0.75.

The key word in "birthday" is "birth". Not conception.

For human cultural purposes, you are 0 days old at the time and date recorded for your birth. It goes on your birth certificate. If you find a culture that celebrates conceptiondays and issues conception certificates, let me know.

Re: Numbering should start at zero (1982)

#75
post #55

1-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 don’t know python but I figured out immediately that it should print ['C', 'B']. Does it? If not, Python is just wrong.

Re: Numbering should start at zero (1982)

#76

1-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.

So if you go into a bar and order a beer, you drink the zeroth beer before the first?

You would, if English were logical as opposed to being a randomly-evolved cultural practice. With computer languages we have the opportunity to fix the mistakes of the past and do better.

Re: Numbering should start at zero (1982)

#77

1-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.

When I was doing actuarial work all ages were age next birthday. So you start at age 1!

Re: Numbering should start at zero (1982)

#78
post #58

Earlier quoted context omitted.

> 1-based numbering is nonsense. How many years old are you when you’re born? Typically 3 months shy of 1 year, so about 0.75.

The key word in "birthday" is "birth". Not conception. For human cultural purposes, you are 0 days old at the time and date recorded for your birth. It goes on your birth certificate. If you find a culture that celebrates conceptiondays and issues conception certificates, let me know.

For human cultural purposes, you are 0 days old at the time and date recorded for your birth

While that is the norm, there both are and have been cultures where you are 1 when you are born (as in you are living your first year of life).

Re: Numbering should start at zero (1982)

#79

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

French (and likely other Latin languages?) are not quite so lucky. "En 8" means in a week, "une quinzaine" (from 15) means two weeks...

Re: Numbering should start at zero (1982)

#80
post #55

Earlier quoted context omitted.

> 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 don’t know python but I figured out immediately that it should print ['C', 'B']. Does it? If not, Python is just wrong.

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.

Post reply on HN