comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: basic question on Ada programming
Date: Thu, 24 Jan 2019 09:58:31 +0200
Date: 2019-01-24T09:58:31+02:00	[thread overview]
Message-ID: <gat9g6Fk8uU1@mid.individual.net> (raw)
In-Reply-To: <q2bd6o$m0v$1@gioia.aioe.org>

On 19-01-24 05:59 , Nasser M. Abbasi wrote:
> I forgot these since I did not program in Ada for long time.
>
> Very basic question. In this
>
> ---------------------------
> with Ada.Text_Io;
> with Ada.Numerics.Real_Arrays;
>
> procedure main is
>   A : constant Ada.Numerics.Real_Arrays.Real_Matrix :=
>            (( 1.0,  2.0,  3.0),
>            ( 4.0,  5.0,  6.0),
>            ( 7.0,  8.0,  9.0));
>
>   v : constant Ada.Numerics.Real_Arrays.Real_Vector := (1.0,2.0,3.0);
>   procedure put (x : Ada.Numerics.Real_Arrays.Real_Vector) is
>     begin
>          FOR e of x LOOP
>              Ada.Text_Io.put_line(float'image(e));
>          END LOOP;
>    end put;
>    --use Ada.Numerics.Real_Arrays;
> begin
>     put(A*v); -- error here, since it does not see *
> end main;
> ------------------
>
> How can I write put(A*v) above, without having to do
>
>      use Ada.Numerics.Real_Arrays;
>
> above it?

Ada.Numerics.Real_Arrays."*" (A,v)

Or do "use type Ada.Numerics.Real_Arrays.Real_Matrix".

Or rename the operator "*" locally. But "use type" is better.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .


      reply	other threads:[~2019-01-24  7:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24  3:59 basic question on Ada programming Nasser M. Abbasi
2019-01-24  7:58 ` Niklas Holsti [this message]
replies disabled

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