Hacker News new | ask | show | jobs
by wmeredith 1062 days ago
If I have some apples on a table and pick single apple up, I don’t have zero apples in my hand. I think that’s why numbering doesn’t start at zero.
5 comments

Hmm but this example only makes me think about how 0 is useful. Otherwise I wouldn't be able to describe your hand prior to picking up the apple.
You're describing counting, not numbering. Like how an array with a count of 1 has one item that is numbered by it's index, 0.
As a counterpoint to that, wouldn't it be kinda nice if an array index equaled the array length and index 0 was equivalent to an empty array.

Think of a basket of apples. If you take the zeroth apple (empty basket), you have no apples. If you take the first apple, you have 1 apple and now the basket is empty again (0).

One also wouldn't have to do [length - 1] to access the last index; it would naturally be [length].

Counting starts at 1, indexing starts at 0.
before picking up apple

    table = {apple0, apple1, apple2, apple3}; //length == 4
    hand = {}; //length == 0
after

    table = {apple0, apple1, apple2}; length == 3
    hand = {apple3}; //length == 1
You count apples in hand by looking at how many items there are, not by what indexes they have.
But how many apples do you have just prior to the scenario starting?