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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ab436e97ff76821f X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.190.104 with SMTP id gp8mr24598821pbc.4.1341921597332; Tue, 10 Jul 2012 04:59:57 -0700 (PDT) Path: l9ni11278pbj.0!nntp.google.com!news1.google.com!goblin3!goblin.stu.neva.ru!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!usenet-fr.net!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Tue, 10 Jul 2012 13:59:53 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Does Ada need elemental functions to make it suitable for scientific work? References: In-Reply-To: Message-ID: <4ffc193b$0$6584$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 10 Jul 2012 13:59:55 CEST NNTP-Posting-Host: 5f45c334.newsspool3.arcor-online.net X-Trace: DXC=ik;\@ae?mRlm7>ihJR;B_cMcF=Q^Z^V3h4Fo<]lROoRa8kFjLh>_cHTX3jmTooB^eXOd7b X-Complaints-To: usenet-abuse@arcor.de Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Date: 2012-07-10T13:59:55+02:00 List-Id: On 10.07.12 01:27, Nasser M. Abbasi wrote: > In Fortran, I can just write V**2, where V is a vector. In Ada, > I can't do that. Since ** is not defined on this array type > and this number type. As Gautier pointed out, a general purpose language must be better than convenient for some. What the convenient operations might offer to a small niche of science is not good enough, even when one personally considers them important. You mentioned operations on vectors. Mine would include operations like - manipulate only values of a vector at certain indices, or produce a result from some components only, fold style, or something even more involved. Such as: Make all negative values 0.0. It is possible to do this using array operations and has been ever since APL (late 1960s), and R, and others, by composing functions. But APL programmers and others have explained that there is only a slight chance that composed operations will be efficient since many results will be computed needlessly, wasting real time and real memory. If efficiency is a concern, one might have to dismiss such designs of inefficient computations. This is s first trade-off. For the above computation, then, I might need some kind of loop, be it expressed as a simple loop, or as a clever, if intricate, tail recursive function. This is easily done using languages Ada, or Fortran, or C++, language that, incidentally, are used to write advanced mathematician's (or physicist's) calculators like Octave. The languages enable methods of controlling the operational aspects of an algorithm that vector operators will by definition take out of the hands of programmers. When writing Ada, I will expect to be able to look at the constituent parts of a computation. For example, my program might need to decide whether or not a computation can continue, at least for parts of the vector, when one component has an unusable intermediate result. For example, Sum (V); -- V = Vector'(1.2, 3.4, broken, ..., 11.12); If programmers should be able to attach their code between the steps that operators perform (be they in parallel or in sequence), then I imagine a library based "operator" could at least be made very flexible. Still, compilers could select more optimal alternatives where possible.