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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.140.233.208 with SMTP id e199mr21331355qhc.8.1446511515448; Mon, 02 Nov 2015 16:45:15 -0800 (PST) X-Received: by 10.182.247.67 with SMTP id yc3mr244364obc.0.1446511515414; Mon, 02 Nov 2015 16:45:15 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!m48no4348122qgd.0!news-out.google.com!z4ni44426ign.0!nntp.google.com!i2no2791783igv.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 2 Nov 2015 16:45:15 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=141.225.243.254; posting-account=TqGH2woAAAAOL7cuGUYe_Weq4IpyHmTd NNTP-Posting-Host: 141.225.243.254 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Understanding generic package functions From: Nick Gordon Injection-Date: Tue, 03 Nov 2015 00:45:15 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:28183 Date: 2015-11-02T16:45:15-08:00 List-Id: Okay, basically I'm writing a demo of Ada for a class, and I'm trying to sh= owcase Ada's math functions. This is the code: function Recoded_Exp(Power: in Float) return Float is -- Base e use Ada.Numerics.Generic_Elementary_Functions; use Ada.Numerics; ExpResult : Float; begin ExpResult :=3D e ** Power; return ExpResult; end Recoded_Exp; As you can see, what I'm trying to accomplish is confine the Float version = of the "**" operator to this function, and I can't seem to do that, as well= as use Ada's language-defined e constant. I've tried this by declaring the= whole name, i.e. "Ada.Numerics.e Ada.Numerics.Generic_Elementary_Functions= ."**" Power", as well without the quotes enclosing the asterisks. Neither w= orked. I've seen something that suggests I have to instantiate the generic package= , but I don't understand how. For reference, the suggested approach is here= : with Square; with Matrices; procedure Matrix_Example is function Square_Matrix is new Square (Element_T =3D> Matrices.Matrix_T, "*" =3D> Matrices.Product); A : Matrices.Matrix_T :=3D Matrices.Identity; begin A :=3D Square_Matrix (A); end Matrix_Example; My thought is that I have to create a new instance of the Generic_Elementar= y_Functions package, but I'm not sure if that's correct, or how to do that.= In general, I'm noticing that the learning curve for Ada is steep, and the= re are not terribly many "quick references" for the language. Nick