comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adambeneschan@gmail.com>
Subject: Re: Function definitions
Date: Fri, 20 Jun 2014 09:43:21 -0700 (PDT)
Date: 2014-06-20T09:43:21-07:00	[thread overview]
Message-ID: <f1939bda-7e5e-4666-ad12-addb1e3ec1a7@googlegroups.com> (raw)
In-Reply-To: <5a8316fb-9b3d-405b-8199-edcaf18dcaa6@googlegroups.com>

On Friday, June 20, 2014 9:22:30 AM UTC-7, montgrimpulo wrote:
> My modified question:
> 
> Hi,
> 
> What would be an answer to the following question:
> There are three files : search.ads, search.adb, main_search.adb.
> 
>  In search.ads two functions are defined:  function F and function G, as
>  
> function F (V : Individual) return Long_Float; and
> function G(M : Natural; V : Individual) return Long_Float;

> 
> Individual is defined as a Record containing several arrays
> with a size determined by variables, eg . 
> 
> type Individual is record
>  X : x_array (0 .. P);
>  Y : y_array (0 .. Q);
>  Z : z_array (0 .. R);
> end record;
>
> In search.adb there are several procedures using the functions F and G defined in search.ads.
> 
> The general search procedure g_search (P, Q, R) (defined in search.adb) is called in main_search.adb. 
> 
> As I want to define  the internal statements of F and G, and other paramenters, (eg. P,Q,R), only in file main_search.adb, I don't know how to define F and G in search.ads / search.adb, as their body is claimed to be missing in search.adb.
> 
> I hope that description is sufficient to answer my question on how to define F and G, so that I can use
> the general search procedure g_search with many different versions of F and G ?

I apologize, but I still cannot figure out what you are asking.  My problem is that you're using phrases that don't seem to have any clear connection with Ada concepts.  What do you mean by "many different versions of F and G"?  If you define a procedure, you're defining only one procedure; you can't normally have many different versions of the same procedure.  Are you trying to define an access-to-procedure type that can be used with a number of different search procedures?  Are you trying to use a generic?  Why do you want one function definition but many versions?  What are you planning on doing with the definition.

It looks like you have some code that isn't compiling.  I would suggest you post the *entire* code that you have so far.  Even if it's not proper Ada, it might show us what you're trying to accomplish.  Your description is not sufficient, and you probably cannot make it sufficient by just trying to use more words to describe it.  Sorry.

                                -- Adam

  reply	other threads:[~2014-06-20 16:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20 15:18 Function definitions montgrimpulo
2014-06-20 15:44 ` Adam Beneschan
2014-06-20 16:22 ` montgrimpulo
2014-06-20 16:43   ` Adam Beneschan [this message]
2014-06-20 16:52     ` Simon Clubley
2014-06-20 17:05       ` Adam Beneschan
2014-06-20 16:43   ` Simon Clubley
2014-06-22  6:59   ` Shark8
2014-06-20 17:39 ` montgrimpulo
2014-06-20 18:19   ` Adam Beneschan
2014-06-20 18:20     ` Adam Beneschan
2014-06-21 20:56     ` Stephen Leake
2014-06-22 12:27     ` Simon Clubley
2014-06-20 20:39   ` Robert A Duff
2014-06-21 12:27 ` montgrimpulo
2014-06-21 12:38   ` Simon Clubley
2014-06-21 17:57   ` Jeffrey Carter
2014-06-21 13:40 ` montgrimpulo
replies disabled

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