|
|
|
|
|
by goto11
2535 days ago
|
|
> Dijkstra's paper makes the case from first-principles that the closed, open interval of [0,n) for sequences is the most appropriate He argues that it is the most appropriate when indexing into an array of the natural numbers starting with 0. If the array in question started with 1, one-based indexing would be most appropriate following exactly the same logic! |
|
> 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.
He never specifies the contents of the array, he's talking about subscripts (i.e. indexes).