comp.lang.ada
 help / color / mirror / Atom feed
From: "Kai Schuelke" <kai.schuelke@gmx.net>
Subject: Re: Function pointer in Ada?
Date: Thu, 16 May 2002 00:30:37 +0200
Date: 2002-05-16T00:30:37+02:00	[thread overview]
Message-ID: <3ce2e175.0@news.unibw-muenchen.de> (raw)
In-Reply-To: abrkr5$b1h$1@nh.pace.co.uk

Hi,

I solved the problem like you suggested but I think that there must be a
better way to do it, too.

I want a program that can solve every mathematical function (e.g.: z = 2*x +
sin(x)) for any value (e.g. x=4). It is enough to work with one mathematical
function at a time. My spec looks like:

-- Spec
package math is
    procedure Set_Function(Func : in STRING);
    function Calculate(Value : in FLOAT) return FLOAT;
end math;

-- Sample program
with math; use math;
procedure sample is
    result : FLOAT;
begin
    Set_Function("2*x+sin(x)");
    result := Calculate(4.0);
end;

What would be the Ada way to do this?






  reply	other threads:[~2002-05-15 22:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-14 12:51 Function pointer in Ada? Henrik Quintel
2002-05-14 13:08 ` Markus Knauss
2002-05-14 13:12 ` Marin David Condic
2002-05-14 14:36 ` Alfred Hilscher
2002-05-14 17:58 ` Kai Schuelke
2002-05-14 18:01   ` Preben Randhol
2002-05-14 18:24   ` David C. Hoos
2002-05-14 20:00     ` Kai Schuelke
2002-05-14 18:25   ` Marin David Condic
2002-05-15 22:30     ` Kai Schuelke [this message]
2002-05-16 11:37       ` Marc A. Criley
2002-05-16 19:06         ` Kai Schuelke
2002-05-16 19:18           ` Preben Randhol
2002-05-16 12:53       ` Georg Bauhaus
replies disabled

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