From mboxrd@z Thu Jan 1 00:00:00 1970 From: dot@dotat.at (Tony Finch) Date: Wed, 7 Jun 2017 15:58:50 +0100 Subject: [TUHS] Array index history In-Reply-To: <20170607135004.GB7802@yeono.kjorling.se> References: <201706071320.v57DKhmJ026303@freefriends.org> <20170607135004.GB7802@yeono.kjorling.se> Message-ID: Michael Kjörling wrote: > > And https://www.bell-labs.com/usr/dmr/www/bcpl.pdf page 11 (PDF page > 14) says: > > > 4.7 Vector Applications > > /.../ > > Semantics: A vector is represented by a pointer to a consecutive > > group of words which are the elements of the vector. The pointer > > points to the zeroth element. That syntax is quite different from the later BCPL that I'm familiar with. http://www.cl.cam.ac.uk/~mr10/bcplman.pdf It has a ! indirection operator which can be both unary and binary, as in old BCPL new BCPL C lv x @x &x rv ptr !ptr *ptr ptr*[i] ptr!i ptr[i] Richards' 1969 paper uses a down-arrow for binary ! You can use "manifest" constants for laying out a structure, e.g. MANIFEST { car; cdr; } declares car and cdr to have values 0 and 1. This lets you do struct-style indirection using the same operator as for array indexing, like in this function definition: LET cadr(p) = p!cdr!car; When I saw how ->integ is used in the 6th Edition kernel it felt very BCPL to me. Tony. -- f.anthony.n.finch http://dotat.at/ - I xn--zr8h punycode Shannon: Cyclonic becoming southwest, 5 or 6. Moderate or rough. Rain. Moderate or poor.