Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site ucbcad.UUCP Path: utzoo!linus!decvax!tektronix!ucbcad!ucbesvax.turner From: ucbesvax.turner@ucbcad.UUCP Newsgroups: net.graphics Subject: Re: Numbering from zero - (nf) Message-ID: <175@ucbcad.UUCP> Date: Fri, 5-Aug-83 07:18:17 EDT Article-I.D.: ucbcad.175 Posted: Fri Aug 5 07:18:17 1983 Date-Received: Fri, 5-Aug-83 16:52:03 EDT Sender: notes@ucbcad.UUCP Organization: UC Berkeley, CAD Group Lines: 25 #R:utcsrgv:-188200:ucbesvax:3800003:000:794 ucbesvax!turner Aug 4 20:10:00 1983 I finally figured out what is, for me, the right way to think about zero-based array indexing. In set theory, natural numbers are represented as sets containing all lesser numbers. Thus, 0 is the empty set, 1 is {0}, 2 is {0, 1}, and so on. The eta symbol for "element of" thus neatly concides with the "<" relation. In C, "int array[size]" is then a mapping from the set "size", containing all natural numbers less than "size", to a subset of all possible ints. To my mind, much more elegant than the fortrash conventions. This discussion should really start heading toward net.flame. To help it get there, let me rephrase the first sentence of this note: "I finally figured out the ONLY REASONABLE WAY to think about...." See you there. Michael Turner ucbvax!ucbesvax.turner