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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.81.99 with SMTP id l63mr1690906yhe.3.1403285977979; Fri, 20 Jun 2014 10:39:37 -0700 (PDT) X-Received: by 10.140.18.235 with SMTP id 98mr55833qgf.1.1403285977962; Fri, 20 Jun 2014 10:39:37 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!i13no7341937qae.1!news-out.google.com!a8ni10892qaq.1!nntp.google.com!w8no7596026qac.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 20 Jun 2014 10:39:37 -0700 (PDT) In-Reply-To: <610b9d5b-a9a5-464d-9de3-b2f754f58cff@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=109.233.148.43; posting-account=ZoAlyAoAAACOOtSiXyaM8n3y8T4ScfeH NNTP-Posting-Host: 109.233.148.43 References: <610b9d5b-a9a5-464d-9de3-b2f754f58cff@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <7597c304-0dc2-41ad-b04e-1aef133e5b63@googlegroups.com> Subject: Re: Function definitions From: montgrimpulo Injection-Date: Fri, 20 Jun 2014 17:39:37 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Received-Bytes: 2528 X-Received-Body-CRC: 3046905530 Xref: news.eternal-september.org comp.lang.ada:20477 Date: 2014-06-20T10:39:37-07:00 List-Id: Here is some code: File search.ads: package search is type x_array is array (positive range <>) of Float; type y_array is array (positive range <>) of Integer; type z_array is array (positive range <>) of Boolean; P,Q,R : Natural; type Individual is record X : x_array (0..P); Y : y_array (0..Q); Z : z_array (0..R); end record; function F (V : Individual) return Float; function G (M : Positive; V : Individual) return Float; procedure g_search ( P,Q,R : Natural); ... procedure p1; procedure p2; ... end search; File search.adb package body search is V : Individual; procedure p1 is FV : Float; ... begin ... FV := F(V); ... end p1; procedure p2 is GMV : Float; M : Positive; ... begin ... GMV := G(M,V); end p2; procedure g_search (P,Q,R : Natural) is ... begin p1; p2; ... end g_search; end search; File main_search.adb with search; use search; procedure main_search is P := 1; Q := 1; R := 1; V : Individual; function F (V : Individual) return Float is begin return Float(V.X(P)); end F; function G (M : Individual) return Float is begin return Float(V.X(M)); end G; begin g_search(P,Q,R); end main_search; This is in principle what I want to set up and run, while I want to be flexible in defining F and G and other parameters, without having to modify the files search.ads and search.adb.