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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5556ca7de188d5ef X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-11 14:45:20 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn4feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc52.POSTED!not-for-mail From: "Mark Lundquist" Newsgroups: comp.lang.ada References: Subject: Re: Multidimensional array vs. array of array X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: <40wR7.34446$ER5.389337@rwcrnsc52> NNTP-Posting-Host: BQvR7-207761-ER5-389153@rwcrnsc52 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc52 1008110720 BQvR7-207761-ER5-389153@rwcrnsc52 (Tue, 11 Dec 2001 22:45:20 GMT) NNTP-Posting-Date: Tue, 11 Dec 2001 22:45:20 GMT Organization: AT&T Broadband Date: Tue, 11 Dec 2001 22:45:20 GMT Xref: archiver1.google.com comp.lang.ada:17790 Date: 2001-12-11T22:45:20+00:00 List-Id: "Lutz Donnerhacke" wrote in message news:slrna1d1o8.7nl.lutz@belenus.iks-jena.de... > How does a skilled Ada programmer define a return type containing a > multidimensional array? Of course, the simple solution works: > > type Equations is array (Rows range <>, Columns range <>) of Number; > type Workspace (row : Rows; col : Columns) is record > eqs : Equations (Rows'First .. row, Columns'First .. col); > ... some more stuff ... > end record; > function Init_Workspace return Workspace; > > But this approach fails miserably on extracting a single row from the result > as well as on construction the result in a recursive function. Would it help you to just define a distinct type to represent a row in isolation, but keep your matrix as defined above (i.e. not in terms of composition of the row type)? -- mark