Dijkstra on Array Index
Dijkstra on Array Index
The computer scientist Edsger W Dijkstra (EWD) thinks it should start at 0.
- Why numbering should start at zero
- By Edsger W Dijkstra.
- http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html

But it's not really convincing.
(1) Dijkstra gave his reasons about how a range function from A to B of integers, should include A and exclude B. For example, he'd have range(2,5)
return [2,3,4]
.
The reason he prefer that because:
- it has the “nice” property that the length of the array is equal to the difference of the indexes.
- But why not A to B such that exclude A and include B? He says this is not natural, because the start number will have to be next smallest integer larger than A.
(2) he then gave his reasons that a index function to extract a array, should start at 0. That is, myArray[0]
returns the first element in the array. Dijkstra thinks this is consistent with his (1).