[TUHS] Array index history
Tim Bradshaw
tfb at tfeb.org
Thu Jun 8 03:59:43 AEST 2017
On 7 Jun 2017, at 13:56, shawn wilson <ag4ve.us at gmail.com> wrote:
>
> I learned the other day that array indexes in some languages start at 1 instead of 0. This seems to be an old trend that changed around the 70s? Who started this? Why was the change made?
I was going to make the obvious glib comment about languages which care more about some transient notion of efficiency than usability leading to 0-based indexing.
But I think in fact it must be cultural: FORTRAN was historically 1-based, of course, and although it looks like LISP 1 (1960) didn't have arrays, LISP 1.5 (1962) *did*, and they were 0-based. It looks to me like ALGOL 58 allowed you to define lower & upper bounds, based on http://www.softwarepreservation.org/projects/ALGOL/report/Algol58_preliminary_report_CACM.pdf/view
So I suspect that languages designed by and for people who actually did a lot of numerical matrix manipulation (ie applied mathematicians, physicists &c) used the conventions of those fields, which were and are 1-based indexing; languages designed by & for formal CS people tended to use zero-based, and languages designed by people who were feeling their oats as regards flexibility allowed user-defined bounds.
--tim
More information about the TUHS
mailing list