Hacker News new | ask | show | jobs
by lambda_cube 5410 days ago
> The note is really about the best way to specify a range/sequence of integers, not why we start from 0 as an index.

Dijkstra deals with what index start with as well, but it comes out as a consequence of which bounds to choose for a range, so it's rather short.

From the article:

When dealing with a sequence of length N, the elements of which we wish to distinguish by subscript, the next vexing question is what subscript value to assign to its starting element. Adhering to convention a) yields, when starting with subscript 1, the subscript range 1 ≤ i < N+1; starting with 0, however, gives the nicer range 0 ≤ i < N.