News for hackers. Stuff that matters.
Re:Why do arrays start at 0? by anigbrowl on Wednesday August 24, 2022 @04:53PM (#32585596)
My point exactly - there isn't an identifiable zeroth finger.
Re:Why do arrays start at 0? by colonwqbang on Wednesday August 24, 2022 @06:03PM (#32586370)
There's not a second finger either. You can convey "two" by showing any two fingers.
Re:Why do arrays start at 0? by gitonthescene on Wednesday August 24, 2022 @04:57PM (#32585646)
And? My solution? Let the kid grow up and learn.
[dead]
Re:Why do arrays start at 0? by pygy_ on Wednesday August 24, 2022 @06:09PM (#32586450)
Anecdotally, I taught my children numbers starting from zero with a similar routine, based on cardinality. They immediately got it.

My kids' school also uses zero-based tables.

"Natural" is a very loaded and ambiguous term, best avoided if you hope to have sane discussions.

Re:Why do arrays start at 0? by lokedhs on Thursday August 25, 2022 @02:01AM (#32590106)
The index is the distance away from the first element. So index 0 is the first element. Index 3 is 3 away from the first element, so the fourth element.

It's the difference between ordinal and cardinal numbers. In other words, counting and indexing.

Re:Why do arrays start at 0? by pygy_ on Thursday August 25, 2022 @03:27AM (#32590693)
Well well well...

https://news.ycombinator.com/item?id=5888459 (quoted here for convenience)

—————

Formally, ordinals start at zero too :-) [0]. We owe their latest definition to Von Neumann, but AFAIK, the former definitions were similar. [...snip...]

--

[0] This is meta-meta-contrarianism.

- The layman counts from 1

- The uptight programmer counts from zero, because Dijkstra said so (or so he thinks).

- The meta-contrarian (I used to be one) says fuck it, ordinals start at one.

- The meta-meta-contrarian reads Wikipedia[1], realizes he was formally wrong, and goes one step further in pedanticity, back to zero [0].

That being said, my brain prefers 1-indexing programming languages like Lua, Julia, R and Matlab...

[1] http://en.wikipedia.org/wiki/Ordinal_number

[0] Help! I'm stuck in a Boolean algebra[1][0]!

[1] http://en.wikipedia.org/wiki/Boolean_algebras_canonically_de...

[0] ... where xor is an addition that wraps around ...

Re:Why do arrays start at 0? by anigbrowl on Wednesday August 24, 2022 @08:23PM (#32587732)
Teaching kids about zero I have no issue with.

I do not believe for a second that you taught them to count by holding up one finger for zero, two fingers for one etc.

Reminder that we're specifically talking about array indexing.

Re:Why do arrays start at 0? by Koshkin on Wednesday August 24, 2022 @07:59PM (#32587535)
Of course there is - I can write “0” on it!