From mboxrd@z Thu Jan 1 00:00:00 1970 From: tfb@tfeb.org (Tim Bradshaw) Date: Wed, 7 Jun 2017 18:59:43 +0100 Subject: [TUHS] Array index history In-Reply-To: References: Message-ID: On 7 Jun 2017, at 13:56, shawn wilson 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