|
|
|
|
|
by alex_muscar
1062 days ago
|
|
The part where he asserts indexing should start at zero is this: > 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. So let us let our ordinals start at zero: an element's ordinal (subscript) equals the number of elements preceding it in the sequence. "A nicer range." This is just Dijkstra's preference. Interestingly, he links ordinals (the subscript) to cardinals (how many numbers there are before the element). The off by one is just as likely in both schemes with half open intervals. The nice property of the length of the sequence falling "for free" from the indices is not essential if you track the length separately. While it was important in the age of machines with severely constrained memories, the downsides outweigh the merits. |
|