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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a277322e4aa032bf,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-30 04:20:08 PST Path: newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!129.240.148.23!uio.no!news.netg.se!dd.chalmers.se!not-for-mail From: f97stdi@dd.chalmers.se (Staffan Dittmer) Newsgroups: comp.lang.ada Subject: math: passing function to function Date: 30 Apr 2001 11:12:22 GMT Organization: Chalmers University of Technology, Sweden Message-ID: <9cjham$lu4$1@eol.dd.chalmers.se> NNTP-Posting-Host: elwing.dd.chalmers.se Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Newsreader: knews 1.0b.1 Xref: newsfeed.google.com comp.lang.ada:7042 Date: 2001-04-30T11:12:22+00:00 List-Id: I'm trying to implement a root finder using the Brent method but find myself getting stuck. I cannot figure out how to pass a function - the function to solve - as a parameter to the solver. I've tried using access to subprogram types to make something like function solver(fun: access to function to solve; ...) return long_float; which usually compiles ok, but exits raising constraint error as soon as the code gets more involved than the rudimentary examples given in the RM. I would very much appreciate it if someone could point me to some mathematical Ada source code where things like the above are bound to be used. The latest line of thought is that it might be possible to make a generic construction like generic function fun(X:float) return float renames function_to_solve; function solver(...) return float is begin ...... but I have no greater hopes for this being even remotely possible. Any other ideas? / Staffan Dittmer