From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f891f,24f3e624c148455d X-Google-Attributes: gidf891f,public X-Google-Thread: 103376,1d321b3a6b8bcab2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-26 08:58:12 PST Path: pad-thai.cam.ov.com!bloom-beacon.mit.edu!news.media.mit.edu!grapevine.lcs.mit.edu!uhog.mit.edu!news.mathworks.com!hookup!swrinde!howland.reston.ans.net!pipex!sunic!news.uni-c.dk!diku.dk!juul From: juul@diku.dk (Anders Juul Munch) Newsgroups: comp.lang.ada,comp.lang.misc Subject: Re: "Subtract C, add Ada" Date: 26 Jan 1995 14:32:53 GMT Organization: Department of Computer Science, U of Copenhagen Sender: juul@embla.diku.dk Message-ID: <3g8bql$77e@odin.diku.dk> References: <3fv6lb$f4u@oahu.cs.ucla.edu> <3g1j4t$g8a@network.ucsd.edu> <3g609q$t4t@watnews1.watson.ibm.com> NNTP-Posting-Host: odin.diku.dk Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: NN version 6.5.0 #13 Xref: pad-thai.cam.ov.com comp.lang.ada:14711 comp.lang.misc:6971 Date: 1995-01-26T14:32:53+00:00 List-Id: ncohen@watson.ibm.com (Norman H. Cohen) writes: >I think CLU, circa 1979, still holds the prize for the best iteration >abstraction. When defining a CLU abstract data type that represents some >sort of collection, you can define one or more iterators among its >operations. An iterator is like a procedure declared to take a value of >the collection type as a parameter and to "yield" values of some element >type. The iterator is executed as a coroutine during the execution of >the loop. Values that are yielded by the iterator become the values of >the loop parameter on successive iterations of the loop. >My CLU syntax is rusty, but if you have the equivalent of a private type >for doubly linked lists, you could define the following iterators for it: > elements = > iter(l: list_type) yields (element_type) > next: cell_type = l; > while next.forward_link ~= l do > yield(next.item) > end > end >Then you could iterate over the private type as follows: > for item in elements(my_list) do > ... > end >[lotsa stuff omitted] Very nice. But how about the kind of parallel iteration over two lists, that other posters showed for Sather and ICON. Can you do that in CLU also? -Anders Munch, juul@diku.dk Still confused but at a higher level