Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The same applies to counting in other bases too. For instance, in 1-indexed counting grids for kids, the last column always feels out of place.

0-indexed decimal grid:

   0  1  2  3  4  5  6  7  8  9
  10 11 12 13 14 15 16 17 18 19
  20 21 22 23 24 25 26 27 28 29
  30 31 32 33 34 35 36 37 38 39
  40 41 42 43 44 45 46 47 48 49
  50 51 52 53 54 55 56 57 58 59
  60 61 62 63 64 65 66 67 68 69
  70 71 72 73 74 75 76 77 78 79
  80 81 82 83 84 85 86 87 88 89
  90 91 92 93 94 95 96 97 98 99
1-indexed decimal grid:

  1  2  3  4  5  6  7  8  9  10
 11 12 13 14 15 16 17 18 19  20
 21 22 23 24 25 26 27 28 29  30
 31 32 33 34 35 36 37 38 39  40
 41 42 43 44 45 46 47 48 49  50
 51 52 53 54 55 56 57 58 59  60
 61 62 63 64 65 66 67 68 69  70
 71 72 73 74 75 76 77 78 79  80
 81 82 83 84 85 86 87 88 89  90
 91 92 93 94 95 96 97 98 99 100


Are you sure it doesn't just look that way because you are used to monospaced fonts? Ask a kid to show you their zeroth finger.


As a kid, I saw these things often on multiple-choice test sheets. The tens digit at the end of each row not matching that at the beginning always seemed awkward, and I wondered why they didn't just start at zero. This was long before I did any programming.

The first year CE being "1" resulting in the new millennium starting at 2001 instead of 2000 also seemed idiotic, and the 1900s being referred to as "the 20th century" was something I always had to consciously compensate for. Numbering items starting at zero would have given us more elegant/less confusing ways to communicate those things.

Zero-based indexing makes things inherently simpler because it matches the way we write numbers (and becomes much more noticeable once you have more than one digit). It's not just an optimization for computers.


Well, given that year numbering system's start in Europe, zero wasn't as broadly accepted as other digits at the time.

By AD 150, Ptolemy, influenced by Hipparchus and the Babylonians, was using a symbol for zero.

https://en.wikipedia.org/wiki/0#History

To keep it confusing: the traditional proleptic Gregorian calendar (like the Julian calendar) does not have a year 0 and instead uses the ordinal numbers 1, 2, ... both for years AD and BC. Thus the traditional time line is 2 BC, 1 BC, AD 1, and AD 2. ISO 8601 uses astronomical year numbering which includes a year 0 and negative numbers before it. Thus the ISO 8601 time line is −0001, 0000, 0001, and 0002.

https://en.wikipedia.org/wiki/Gregorian_calendar#Dual_dating


I asked my son to show me zero fingers(after show me 2 fingers and 5 fingers), he closed his fists.


My point exactly - there isn't an identifiable zeroth finger.


There's not a second finger either. You can convey "two" by showing any two fingers.


And? My solution? Let the kid grow up and learn.


[flagged]


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.


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.


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


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.


Of course there is - I can write “0” on it!


Counting fingers (or other items) isn't a positional numeral system, so it's really apples to oranges. Also, "first" has a meaning of "nothing precedes it", which is separate from the indexing system", it shouldn't mean "at index 1", unless otherwise specified.


Though the idea of an index as a position instead of an address is weird to me, you can indeed make that analogy. The "first" element of an array has the index zero, as in "zero elements precede it".


> Ask a kid to show you their zeroth finger.

They will get confused because every day counting got it wrong. In a perfect world we would count fingers from 0.


Neither looks like the canonical choice to me. They are both just as good.


counting grid? What even are these?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: