comp.lang.ada
 help / color / mirror / Atom feed
From: f97stdi@dd.chalmers.se (Staffan Dittmer)
Subject: Re: math: passing function to function
Date: 30 Apr 2001 13:51:37 GMT
Date: 2001-04-30T13:51:37+00:00	[thread overview]
Message-ID: <9cjql9$p1f$1@eol.dd.chalmers.se> (raw)
In-Reply-To: 3AED53F7.FAED7F1@earthlink.net

Thanks for replies.
Giving up on the access to subprogram approach for now
since I've had better success with the generic approach.

This seems to work the way I want it, also probably less 
prone to self induced constraint errors ...
 
package Root_Pak is
   generic
   with function Fun(X:Float) return Float;
   function Root(X1,X2:Float) return Float;
end Root_Pak;

package Fun_Pak is
   function To_Solve(X:Float) return Float;
end Fun_Pak;

with Text_Io,Fun_Pak,Root_pak;
use Text_Io;
procedure calc is
   function Solve is new Root_Pak.root(Fun_Pak.To_Solve);
   X1,X2:Float:=4.0;
begin
   Put_Line(Float'Image(Solve(X1,X2)));
end calc;

/ Staffan



  reply	other threads:[~2001-04-30 13:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-30 11:12 math: passing function to function Staffan Dittmer
2001-04-30 12:10 ` Jacob Sparre Andersen
2001-04-30 12:57 ` Marc A. Criley
2001-04-30 13:51   ` Staffan Dittmer [this message]
2001-04-30 14:38 ` Ted Dennison
replies disabled

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