Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site fortune.UUCP Path: utzoo!linus!philabs!seismo!harpo!ihnp4!fortune!rpw3 From: rpw3@fortune.UUCP Newsgroups: net.lang Subject: Re: loop indexing - (nf) Message-ID: <2283@fortune.UUCP> Date: Mon, 16-Jan-84 04:02:57 EST Article-I.D.: fortune.2283 Posted: Mon Jan 16 04:02:57 1984 Date-Received: Tue, 17-Jan-84 02:41:32 EST Sender: notes@fortune.UUCP Organization: Fortune Systems, Redwood City, CA Lines: 28 #R:uvacs:-112200:fortune:15100008:000:851 fortune!rpw3 Jan 15 20:24:00 1984 In some languages, you can say things like for all x in {set/range/list} do ...; so to add all the values of a singly-dimensioned array s := 0; for all i in { lowbound(a):highbound(a) } do s := s + a[i]; Notice that the compiler can use random order, if it likes, as long as it covers all of the entries. These things are in the class of language features called "generators". Generators were introduced exactly to address the point of the previous note: We sometimes need ways to indicate to the compiler a set of computations to be done, without implying an ordering to that set. (I'm afraid I've forgotten what languages use generators, other than SCHEME's "streams".) Rob Warnock UUCP: {sri-unix,amd70,hpda,harpo,ihnp4,allegra}!fortune!rpw3 DDD: (415)595-8444 USPS: Fortune Systems Corp, 101 Twin Dolphins Drive, Redwood City, CA 94065