comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: project euler 26
Date: Mon, 4 Sep 2023 21:20:56 +0200	[thread overview]
Message-ID: <ud5amn$1jkrc$1@dont-email.me> (raw)
In-Reply-To: <878r9mudvj.fsf@bsb.me.uk>

On 2023-09-04 18:01, Ben Bacarisse wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> 
>> On 2023-09-04 13:06, Niklas Holsti wrote:
>>> On 2023-09-04 12:19, CSYH (QAQ) wrote:
>>>> I am new to Ada, I know is there a good way to start this program?
>>>> thanks
>>>> https://projecteuler.net/problem=26
>>> First invent/discover the method (algorithm) for solving the problem,
>>> without thinking about the programming language.
>>> I don't think any language has built-in features that would lead to a
>>> direct solution, although some functional language with lazy evaluation
>>> could come close, because such languages can manipulate unbounded
>>> (potentially infinite) sequences of values. Such sequences can be handled
>>> in Ada, too, but with more effort -- they are not "built in" to Ada.
>>
>> Infinite division does not require big numbers, which Ada 22 has, but I
>> wound not use them anyway because the performance would be abysmal.
>>
>> BTW, Ada is perfect for numeric algorithms no need to resort to functional
>> mess... (:-))
> 
> Perfect?  That's a bold claim!

Ada is a very improved descendant of Algol 60, which was designed to 
codify algorithms.

> Mind you, I don't think this problem is really a numerical one in that
> sense.  It needs some simple integer arithmetic but then every language
> is perfect for that sort of arithmetic.

That is still all about algorithms (rather than about for example 
building abstractions as in the case of OOP)

> Using a functional mess (Haskell) a simple, native solution (i.e. using
> no modules) is only 9 lines long.

Apart from the fundamental inconsistency of functional paradigm: 
computing is about transition of states and nothing else; the imperative 
languages express solutions, i.e. an algorithm. Functional, and in 
general, declarative languages express puzzles.

They remind me a math examination tasks on studying a function. Here is 
a definition. Go figure out the properties and behavior...

Or, if you want, functional is like a chess composition: white to move 
and checkmate in 4 moves. Challenging, but Ada is about playing chess.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2023-09-04 19:20 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04  9:19 project euler 26 CSYH (QAQ)
2023-09-04 11:06 ` Niklas Holsti
2023-09-04 12:39   ` Dmitry A. Kazakov
2023-09-04 16:01     ` Ben Bacarisse
2023-09-04 19:20       ` Dmitry A. Kazakov [this message]
2023-09-04 20:18         ` Ben Bacarisse
2023-09-04 21:00           ` Dmitry A. Kazakov
2023-09-04 23:16             ` Ben Bacarisse
2023-09-05  7:23               ` Dmitry A. Kazakov
2023-09-05 15:18                 ` Ben Bacarisse
2023-09-05 17:08                   ` Dmitry A. Kazakov
2023-09-06  1:10                     ` Ben Bacarisse
2023-09-06  7:06                       ` Dmitry A. Kazakov
2023-09-06 15:16                         ` Ben Bacarisse
2023-09-06 15:54                           ` Dmitry A. Kazakov
2023-09-06 23:32                             ` Ben Bacarisse
2023-09-07  9:02                               ` Dmitry A. Kazakov
2023-09-08  1:32                                 ` Ben Bacarisse
2023-09-08  7:23                                   ` Dmitry A. Kazakov
2023-09-09  0:25                                     ` Ben Bacarisse
2023-09-09  9:32                                       ` Dmitry A. Kazakov
2023-09-10  1:20                                         ` Ben Bacarisse
2023-09-10  8:46                                           ` Dmitry A. Kazakov
2023-09-10 19:22                                             ` Ben Bacarisse
2023-09-11  6:53                                               ` Dmitry A. Kazakov
2023-09-11 16:13                                                 ` Ben Bacarisse
2023-09-12  7:17                                                   ` Dmitry A. Kazakov
2023-09-13 12:24                                                     ` Ben Bacarisse
2023-09-14  6:33                                                       ` Dmitry A. Kazakov
2023-09-14 14:30                                                         ` Ben Bacarisse
2023-09-08  6:09                               ` G.B.
2023-09-08 21:02                                 ` Ben Bacarisse
2023-09-09  8:13                                   ` G.B.
2023-09-09 21:04                                     ` Ben Bacarisse
2023-09-10  9:11                                     ` Dmitry A. Kazakov
2023-09-05 17:35                 ` moi
2023-09-04 14:23 ` Dmitry A. Kazakov
2023-09-07  7:31 ` Francesc Rocher
2023-09-15  9:07   ` CSYH (QAQ)
2023-09-19  7:59     ` comp.lang.ada
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox