comp.lang.ada
 help / color / mirror / Atom feed
* Implementing Memorize
@ 2003-10-22  8:52 Lutz Donnerhacke
  2003-10-22 15:00 ` Frank J. Lhota
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Lutz Donnerhacke @ 2003-10-22  8:52 UTC (permalink / raw)


In order to implement a generic memorize, I tried the following
  (see <slrnbpajhj.ns.lutz@taranis.iks-jena.de> for the context)

   generic
      with function Callback (n : Natural) return Natural;
   function Action (n : Natural) return Natural;
   
   function Action (n : Natural) return Natural is
   begin
      case n is
         when 0 | 1  => return 1;
         when others => return Callback(n-1) + Callback(n-2);
      end case;
   end Action;
   
   function Fib_Direct is new Action (Fib_Direct); -- won't compile



^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: Implementing Memorize
@ 2003-10-22  9:28 christoph.grein
  2003-10-22 10:32 ` Lutz Donnerhacke
  0 siblings, 1 reply; 20+ messages in thread
From: christoph.grein @ 2003-10-22  9:28 UTC (permalink / raw)
  To: comp.lang.ada, lutz

>    generic
>       with function Callback (n : Natural) return Natural;
>    function Action (n : Natural) return Natural;
>    
>    function Action (n : Natural) return Natural is
>    begin
>       case n is
>          when 0 | 1  => return 1;
>          when others => return Callback(n-1) + Callback(n-2);
>       end case;
>    end Action;
>    
>    function Fib_Direct is new Action (Fib_Direct); -- won't compile
              ~~~~~~~~~~
              This hides the other homonyme from all visibility until the end of 
the declaration.



^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2003-10-23 14:36 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-22  8:52 Implementing Memorize Lutz Donnerhacke
2003-10-22 15:00 ` Frank J. Lhota
2003-10-22 17:03 ` tmoran
2003-10-23  0:25 ` Georg Bauhaus
  -- strict thread matches above, loose matches on Subject: below --
2003-10-22  9:28 christoph.grein
2003-10-22 10:32 ` Lutz Donnerhacke
2003-10-22 10:48   ` Marius Amado Alves
2003-10-22 11:07     ` Lutz Donnerhacke
2003-10-22 11:33       ` Lutz Donnerhacke
2003-10-22 11:56         ` Lutz Donnerhacke
2003-10-22 12:29         ` Marius Amado Alves
2003-10-22 12:52           ` Lutz Donnerhacke
2003-10-22 13:42             ` Marius Amado Alves
2003-10-22 12:08       ` Dmitry A. Kazakov
2003-10-22 12:10         ` Lutz Donnerhacke
2003-10-22 15:23           ` Dmitry A. Kazakov
2003-10-22 19:41             ` Lutz Donnerhacke
2003-10-23 14:36               ` Dmitry A. Kazakov
2003-10-22 19:29       ` Robert I. Eachus
2003-10-22 19:44         ` Lutz Donnerhacke

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