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,d74d61525ce986e9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-22 12:44:40 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.vmunix.org!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Re: Implementing Memorize Date: Wed, 22 Oct 2003 19:44:39 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: <3F96DA49.5020101@comcast.net> NNTP-Posting-Host: belenus.iks-jena.de X-Trace: branwen.iks-jena.de 1066851879 21699 217.17.192.34 (22 Oct 2003 19:44:39 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Wed, 22 Oct 2003 19:44:39 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:1463 Date: 2003-10-22T19:44:39+00:00 List-Id: * Robert I. Eachus wrote: > Lutz Donnerhacke wrote: >> Calculating Fibbonacci numbers recursivly is easy but braindead. Languages >> with access to the symbol table at execution time are able to change the the >> reccuring call with a memorize wrapper which returns already computed values >> immediatly instead of recalculating them. In the referenced article I wrote >> an C-Implementation of such a wrapper. Now I'm looking for a more elegant >> version in Ada. > > Calculating Fibonacci numbers recursively is definitely braindead. Try > this approach instead. I'd like to abstract the problem from fib to an arbitary external provided recursive function. So I'm looking for an elegant way to define the generic memorize.