News for hackers. Stuff that matters.
Re:The origin of zero-based array indexing by jebus989 on Tuesday December 10, 2013 @04:25AM (#6879750)
"Some people" is understated; if you're holding one orange and I ask for your first orange then you give me that one, in your first hand. I'm over-emphasising but the point is that no zeroes are involved.

It's a trade-off, if we were bending entirely to the computer's will we'd all be programming machine code, whereas there's overhead in using more natural language. Honestly I've bought this 0-indexing is the Right Way for a long time but the more I use R the more a 1-index seems to make sense for high-level languages.

Re:The origin of zero-based array indexing by lucideer on Tuesday December 10, 2013 @05:36AM (#6879946)
An index is the beginning of a unit - the point at which it is found, where it begins. The index doesn't represent the unit itself, just where it is located.

Your orange takes the zeroth index becoming the first orange: http://i.imm.io/1lWRO.png

People understand the concept of zero perfectly. They know the day doesn't begin at 1am, they know babies aren't born 1 years old. This isn't a computer-specific concept in any way.

Re:The origin of zero-based array indexing by adam-a on Tuesday December 10, 2013 @06:05AM (#6880041)
> They know the day doesn't begin at 1am, they know babies aren't born 1 years old. This isn't a computer-specific concept in any way.

This is true, and an interesting point, but also nobody describes a baby as being zero years old, or the time as being zero-o'clock. People avoid zero in these situations and find alternatives - i.e. 3-months or 12.30am.

Personally I see both sides but the point is that whenever you make something divisible, the first unit is 1 and that's what people call it.

Re:The origin of zero-based array indexing by tmoertel on Tuesday December 10, 2013 @07:46AM (#6880380)
Actually, in the US military, it's common to refer to the first hour of the day as zero. As in, "zero hundred thirty hours" for 30 minutes after midnight.
Re:The origin of zero-based array indexing by mmorris on Tuesday December 10, 2013 @09:30AM (#6880876)
That the clock starts at 12 has annoyed me for quite a long time (i.e., 12PM comes before 1PM). I kind of wish that non-military usage also used 0:00-11:59, if only for the logical consistency of it.

Alternatively we could just switch 12PM and 12AM, but that would mess with midnight == start of the day.

Unfortunately I think I'm doomed to suffer through this inconsistency, since it doesn't seem to bother anyone else.

Re:The origin of zero-based array indexing by serans on Tuesday December 10, 2013 @10:00AM (#6881034)
Why not use a 24 hour clock then? In Europe, 24 hour (digital) clocks going from 00:00 to 23:59 are commonly used. My French friends even use it even when speaking (I admit is kind of weird to hear "see you at sixteen thirty"), while in other countries such as Italy they use 24 hour clocks as well, but they "translate" it when speaking.
Re:The origin of zero-based array indexing by mmorris on Tuesday December 10, 2013 @10:57AM (#6881395)
Yeah, I think that would be better.

I guess for me personally the perfect solution would be a 12-hour clock that operates on the same principles as the European 24-hour (which I think is the same as the military clock?). So 00:00 to 11:59, twice per day.

But honestly my whole argument is pretty academic, so I'll probably just put up with the clock starting at 12.

Re:The origin of zero-based array indexing by jebus989 on Tuesday December 10, 2013 @05:43AM (#6879965)
This confuses measuring continuous variables with discrete indexing. I'm certainly not arguing that zero isn't a well-understood concept.
Re:The origin of zero-based array indexing by zvrba on Tuesday December 10, 2013 @05:43AM (#6879968)
> I ask for your first orange then you give me that one, in your first hand

It's the difference between ordinals and cardinals. In human languages I see ordinals as a pure shorthand: you could just as well say "give me orange number zero", except it's more cumbersome. I honestly can't think of a context (in human languages) where ordinals would be something more than a mere convenience. I believe the existence of ordinals is a technically unnecessary historical artifact: counting was invented before zero.

PS: I doubt people number their hands. A person would say "in your left hand", not in "your first hand".

Re:The origin of zero-based array indexing by paulnechifor on Tuesday December 10, 2013 @05:09AM (#6879876)
> if you're holding one orange and I ask for your first orange then you give me that one, in your first hand. I'm over-emphasising but the point is that no zeroes are involved.

No ones are involved either. I don't have a "first" hand and when you request a first orange, you're just asking for the head of the ordered set.

Re:The origin of zero-based array indexing by jebus989 on Tuesday December 10, 2013 @05:39AM (#6879955)
I get it, believe me I do, but pedantry aside, we know how any non-computer scientist or programmer would address the initial item of any sequence (indeed the same way a mathematician would).
Re:The origin of zero-based array indexing by mtdewcmu on Tuesday December 10, 2013 @04:57AM (#6879847)
Well, frankly, I always thought 0-indexing made perfect sense, given the elegant symmetry with pointer arithmetic in C. It also makes sense in that variables are naturally initialized to zero, and that puts an index right at the start of an array. Everything just falls into place.
Re:The origin of zero-based array indexing by loxs on Tuesday December 10, 2013 @04:31AM (#6879766)
Same thing with Erlang... it seemed so weird at start... now I hate all 0-indexed languages.
Re:The origin of zero-based array indexing by dspig on Tuesday December 10, 2013 @05:12AM (#6879884)
Well, you don't have to use the 0th index, it's better than wanting to in a language where you can't!