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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: A few questions Date: Wed, 04 Nov 2015 16:19:41 +0000 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="2d7699570724a9a82a760842267e2c56"; logging-data="29673"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19JvH7+E05MT8HHUW0HfGLOtyDSltcyGEQ=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:FeoSZ4KMtB/Nood68Q2/BEKalfs= sha1:uAtdWenSnVyYZ2uK5yYuAjsysZU= Xref: news.eternal-september.org comp.lang.ada:28217 Date: 2015-11-04T16:19:41+00:00 List-Id: Simon Wright writes: > "Randy Brukardt" writes: > >> "Simon Wright" wrote in message >> news:ly611kmh1g.fsf@pushface.org... >> ... >>> I wrote the attached, using generalized iteration, which bears a >>> strong resemblance to the standard container iteration (the names >>> bear too strong a resemblance! but this way you can see the >>> commonality). >> >> I suspect you could have written this in a lot simpler >> fashion. Something similar to the Prime_Numbers iterator found in the >> ACATS foundation (F552A00, look in the support subdirectory, >> specifically >> http://www.ada-auth.org/cgi-bin/cvsweb.cgi/acats/support/f552a00.a) >> would be a starting point. (Thanks again to Brad Moore for creating >> this foundation and the associated ACATS tests to give all Ada >> implementers something to use as a correct example of iterators.) > > Great pointer. Though I think the Date case would be a bit more > complicated, because you couldn't constrain a Date_Set by Times or > Durations. And I was hoping to write with Ada.Text_IO; with F552A00_Prime_Numbers; procedure Primes is begin for P of F552A00_Prime_Numbers.Prime_Number_Set'(Max_Value => 31) loop Ada.Text_IO.Put_Line (P'Img); end loop; end Primes; but (surprise) primes.adb:5:08: cannot iterate over "Prime_Number_Set"