From mboxrd@z Thu Jan 1 00:00:00 1970 From: ag4ve.us@gmail.com (shawn wilson) Date: Thu, 8 Jun 2017 10:56:18 -0400 Subject: [TUHS] Array index history In-Reply-To: <87o9tybtwj.fsf@gmail.com> References: <201706071320.v57DKhmJ026303@freefriends.org> <20170607135004.GB7802@yeono.kjorling.se> <201706071402.v57E2dTs032508@freefriends.org> <87o9tybtwj.fsf@gmail.com> Message-ID: On Jun 8, 2017 7:29 AM, "Christian Neukirchen" wrote: arnold at skeeve.com writes: > Michael Kjörling wrote: > >> On the other hand, before C, both B and BCPL used zero-based indexing. >> So if we trace C's family tree, there is certainly precedence for >> zero-based indexing into arrays. > > Ah. OK. I never used either language. I get the impression that BCPL > wasn't used / known much in the US, but I could be wrong. I was exposed > to BASIC and FORTRAN (and computer programming) circa 1976 and to C > in 1980. Anything before then is before my time ... :-) It may be obvious, but awk(1) uses 1-indexing for arrays and string offsets, and shell arguments are indexed from 1 too (which may be reasonable given the special behavior of argv[0], but I think this resulted in rc(1) being 1-indexed for lists). pic(1) sensibly uses 1-indexing in the "Nth" notation. I never thought of it like that wrt awk. However, I always thought of $0 as "self" in higher level OO languages. -------------- next part -------------- An HTML attachment was scrubbed... URL: