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-Received: by 2002:a6b:1702:: with SMTP id 2-v6mr1033867iox.101.1525053045894; Sun, 29 Apr 2018 18:50:45 -0700 (PDT) X-Received: by 2002:a9d:5a0a:: with SMTP id v10-v6mr737277oth.13.1525053045700; Sun, 29 Apr 2018 18:50:45 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.fcku.it!peer03.fr7!futter-mich.highwinds-media.com!peer02.am4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!k65-v6no1911481ita.0!news-out.google.com!15-v6ni2858itg.0!nntp.google.com!f63-v6no1913104itc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 29 Apr 2018 18:50:45 -0700 (PDT) In-Reply-To: <87bme1oax6.fsf@nightsong.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=96.247.198.106; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 96.247.198.106 References: <1c73f159-eae4-4ae7-a348-03964b007197@googlegroups.com> <87k1su7nag.fsf@nightsong.com> <87po2la2qt.fsf@nightsong.com> <87in8buttb.fsf@jacob-sparre.dk> <87wowqpowu.fsf@nightsong.com> <87efiyuh10.fsf@jacob-sparre.dk> <87vacanebz.fsf@nightsong.com> <87a7tlvppi.fsf@jacob-sparre.dk> <87k1sponey.fsf@nightsong.com> <658b4dfa-6c52-42d0-a289-8c612e6ee6a5@googlegroups.com> <87fu3dogk5.fsf@nightsong.com> <87bme1oax6.fsf@nightsong.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: How to get Ada to ?cross the chasm?? From: Jere Injection-Date: Mon, 30 Apr 2018 01:50:45 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Body-CRC: 2189562912 X-Received-Bytes: 3574 Xref: reader02.eternal-september.org comp.lang.ada:51813 Date: 2018-04-29T18:50:45-07:00 List-Id: On Sunday, April 29, 2018 at 7:22:34 PM UTC-4, Paul Rubin wrote: > gautier writes: > > x: T := ((1, 2), (3, 4), (5, 6)); > > Thanks. Can you concatenate two arrays like that? > You can: type Array_Element is array (Integer range <>) of Integer; type Array_Type is array (Integer range <>) of Array_Element(1..2); x : Array_Type := ((0,1), (2,3), (4,5)); y : Array_Type := ((6,7), (8,9)); z : Array_Type := x & y; a : Array_Type := z & Array_Type'(1 => (10,11)); full test program: with Ada.Text_IO; use Ada.Text_IO; procedure jdoodle is procedure Test is type Array_Element is array (Integer range <>) of Integer; type Array_Type is array (Integer range <>) of Array_Element(1..2); function To_String(Values : Array_Element; Count : Natural := 0) return String is Index : Integer := Values'First + Count; begin if Count = 0 then return "(" & Integer'Image(Values(Index)) & To_String(Values,1); elsif Count >= Values'Length then return ")"; else return "," & Integer'Image(Values(Index)) & To_String(Values, Count + 1); end if; end To_String; x : Array_Type := ((0,1), (2,3), (4,5)); y : Array_Type := ((6,7), (8,9)); z : Array_Type := x & y; a : Array_Type := z & Array_Type'(1 => (10,11)); begin for e of a loop Put_Line(To_String(e)); end loop; end Test; begin Test; end jdoodle;