comp.lang.ada
 help / color / mirror / Atom feed
From: Bill Findlay <yaldnif.w@blueyonder.co.uk>
Subject: Re: ee9, a GNU emulator of the EE KDF9
Date: Tue, 30 Aug 2011 13:32:31 +0100
Date: 2011-08-30T13:32:31+01:00	[thread overview]
Message-ID: <CA8296EF.31DD%yaldnif.w@blueyonder.co.uk> (raw)
In-Reply-To: 1gw7bd73wia3k$.fsth1w5i71ts.dlg@40tude.net




On 30/08/2011 12:51, in article 1gw7bd73wia3k$.fsth1w5i71ts.dlg@40tude.net,
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:

> On Tue, 30 Aug 2011 11:39:45 +0100, Bill Findlay wrote:
> 
>> Jensen's device has yet to (re-)surface in Ada.
> 
> http://rosettacode.org/wiki/Jensen%27s_Device#Ada
> 

Jensen's device would be written more like this in Ada 60:

> procedure Jensen_Device is
> 
>   function Sum (
>                 X  : in out Float;
>                 Lo,
>                 Hi : in Float;
>                 F  : in Float with Parameter_Mode => By_Name  -- 8-)
>                ) 
>    return Float is
>       Temp : Float := 0.0;
>    begin
>       X := Lo;
>       while X <= Hi loop
>          Temp := Temp + F;
>          X := X + 1.0;
>       end loop;
>       return Temp;
>    end Sum;
>     
>    Y : Float;
> 
> begin
>    Put_Line (Float'Image (Sum (Y, 1.0, 100.0, 1.0 / Y)));
> end Jensen_Device;

Much neater!

-- 
Bill Findlay
with blueyonder.co.uk;
use  surname & forename;




      reply	other threads:[~2011-08-30 12:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-30  2:27 ee9, a GNU emulator of the EE KDF9 Bill Findlay
2011-08-30  9:49 ` comp.lang.php
2011-08-30 10:39   ` Bill Findlay
2011-08-30 11:51     ` Dmitry A. Kazakov
2011-08-30 12:32       ` Bill Findlay [this message]
replies disabled

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