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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bd50112c03f1f521 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!postnews.google.com!y71g2000hsa.googlegroups.com!not-for-mail From: soychangoman@gmail.com Newsgroups: comp.lang.ada Subject: Re: Defining a binary operator between function access types: Is it possible? Date: Tue, 21 Oct 2008 06:17:39 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: 190.246.68.56 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1224595060 19740 127.0.0.1 (21 Oct 2008 13:17:40 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 21 Oct 2008 13:17:40 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y71g2000hsa.googlegroups.com; posting-host=190.246.68.56; posting-account=qyu9oAoAAADnlcmgaGLAx2wCGPoJM9US User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.3) Gecko/2008092814 Iceweasel/3.0.3 (Debian-3.0.3-2),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:2448 Date: 2008-10-21T06:17:39-07:00 List-Id: Well, first of all thanks for all the responses. I finally found a solution that makes me happy and I was able to implement. Here's what I did: I defined: -------------- type Symbols_Enumeration is ('+', '-','*', '/', Power, analytic); package Symbols is new Stacks(Symbols_Enumeration); type Analytic_Function_Access is access function ( x : Real'Base) return Real'Base; package Analytics is new Stacks(Analytic_Function_Access); package Real_Numbers is new Stacks(Real); type My_Function is record Symbols_Stack : Symbols.Stack; Analytics_Stack : Analytics.Stack; Real_Numbers_Stack : Real_Numbers.Stack; end record; ------------- Where the package Stacks is a generic Stack manager. The idea is to use the calculator notation, I mean, if I do: ------ f1,f2,f : My_Function; --some kind of initialization to f1 and f2 where I say that --f1.Symbols_Stack f1.Analytic_Stack --|analytic| |f1_acc| -- the same for f2 f :=3D f1 + f2; ------ then f will have f.Symbols_Stack f.Analytic_Stack |+ | |f1_acc| |analytic| |f2_acc| |analytic| If I have a * or even a ** the compiler takes care of precedence of the operators, all i have to take care is to put everithing on the stack. example: f :=3D (f1+f2) * (f3+f4); f.Symbols_Stack f.Analytic_Stack |* | |+ | |f1_acc| |analytic| |f2_acc| |analytic| |f3_acc| |+ | |f4_acc| |analytic| |analytic| If I want to do this f:=3D f1 * 2.0; then f.Symbols_Stack f.Analytic_Stack f.Real_Numbers_Stack |* | |analytic | |Real_Number| |f1_acc| |2.0 | When I want to get f(x) I just do like the calculator. I Get symbol by Symbol in the Symbols_Stack and when I find something that is not a operator (like a 'Real_Number') I look for it in the corresponding stack (f.Real_Numbers_Stack). I didn't post the source code becouse it's a little long, but if anyone has curiosity just mail me. About Ivan Levashew's Post... well I realy didn't quite understood yet, but I think that if the package is used adequately it won't blow my stack away, even if it's used for big calculations, am I right? Thanks everyone again =3D) Saludos Mat=EDas Niklison