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!decvax!harpo!eagle!mhuxl!ihnp4!fortune!norskog From: norskog@fortune.UUCP (Lance Norskog) Newsgroups: net.lang Subject: Re: loop indexing - (nf) Message-ID: <2287@fortune.UUCP> Date: Mon, 16-Jan-84 15:18:33 EST Article-I.D.: fortune.2287 Posted: Mon Jan 16 15:18:33 1984 Date-Received: Wed, 18-Jan-84 01:15:14 EST References: <2283@fortune.UUCP> Organization: Fortune Systems, Redwood City, CA Lines: 32 A more generalized form of this is: for x,y in sequence(x,y) Fragment rof . . . GENERATOR sequence(a:int,b:boolean) loop . . yield a,b . . pool ROTARENEG Every 'yield' is implemented as a procedure call: Fragment(a,b). When 'sequence' returns, the for loop is over. The only place I have seen this is in academic "toy" languages; the only implemented version I have used was the language "Small" in a compiler class; we had to add features to a skeletal language and its parser/compiler/interpreter system. I thought generators (we called them "iterators") were cute so I implemented them as my project. They are a halfway step to object-oriented programming in a procedural language.