From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: project euler 26 Date: Tue, 5 Sep 2023 09:23:46 +0200 Organization: A noiseless patient Spider Message-ID: References: <878r9mudvj.fsf@bsb.me.uk> <87a5u1u1yv.fsf@bsb.me.uk> <8734ztttpc.fsf@bsb.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 5 Sep 2023 07:23:47 -0000 (UTC) Injection-Info: dont-email.me; posting-host="7b327c4b880c05c3511b9a0af588fe44"; logging-data="1992836"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Kzwn9gEujIgEMCFK/2jD/LEYU+0cPGAo=" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Cancel-Lock: sha1:p3/s/UENhT/RR25uQLV9mYHl26Q= Content-Language: en-US In-Reply-To: <8734ztttpc.fsf@bsb.me.uk> Xref: news.eternal-september.org comp.lang.ada:65596 List-Id: On 2023-09-05 01:16, Ben Bacarisse wrote: > The term "abstraction" is usually taken to be more general than that so > as to include function (or procedural) abstraction. These are means of software decomposition rather than abstraction (of something). > Ada is good at that, but the syntax is sufficiently cumbersome that I > think it discourages people from exploiting that part of the language. > Mind you, I am no Ada expert so maybe it's simpler to do than I think. If the program does not resemble electric transmission noise, some people call the language syntax cumbersome... (:-)) > Here's my Ada solution: > > with Ada.Text_IO; use Ada.Text_IO; > with Ada.Containers.Ordered_Maps; use Ada.Containers; > > procedure Euler_26 is > > function Period(Divisor: Positive) return Positive is You cannot use a number here because the period may have leading zeros. > I know it won't make this program shorter, but it would be interesting > to know how it might be done. The goal of engineering is not making programs shorter, it is to make them understandable, safer, reusable, maintainable, extensible, integrable. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de