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-Thread: 103376,693e247f5dca709d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread3.news.pas.earthlink.net.POSTED!14bb18d8!not-for-mail Sender: Matthew Heaney@MHEANEYIBMT43 Newsgroups: comp.lang.ada Subject: Re: How to use associative arrays in Ada 2005? References: <1164103903.240838.37230@j44g2000cwa.googlegroups.com> <1164152113.623461.130190@e3g2000cwe.googlegroups.com> <1164310051.811802.237400@l12g2000cwl.googlegroups.com> <14xluht6idlik$.1cxod3mnfvcfs.dlg@40tude.net> <1164567954.228842.32980@h54g2000cwb.googlegroups.com> <456b6536$0$1006$39cecf19@news.twtelecom.net> From: Matthew Heaney Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 28 Nov 2006 01:55:07 GMT NNTP-Posting-Host: 24.149.57.125 X-Complaints-To: abuse@earthlink.net X-Trace: newsread3.news.pas.earthlink.net 1164678907 24.149.57.125 (Mon, 27 Nov 2006 17:55:07 PST) NNTP-Posting-Date: Mon, 27 Nov 2006 17:55:07 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news2.google.com comp.lang.ada:7718 Date: 2006-11-28T01:55:07+00:00 List-Id: Simon Wright writes: > But that only works for the first map. You couldn't find all the > Smiths that way. > > If that's what you're after, you need (in database terms) a second > independent index. Right. In the GNAT distribution there's an examples directory that includes some container examples. The library example does what you suggest, using multiple containers to provide the necessary query support. > I've just read (and re-read, and re-read) A.18.5(43) and I see what > you mean. Perhaps it's a bit late. I had read 'same hash => > equivalent' whereas it's actually 'equivalent => same hash'. Right. > > If you have as your key a record comprising the 3 strings (nation, > > family name, given name), then "=" would be adequate for > > Equivalent_Keys. > > I would have a record with (nation, family_name, given_name, age) -- > if you have filtered out a container with just the Smiths you'd want > to know the other facts for each of them, too. You could have the map of maps of maps (as in the OP), and use another container (an ordered multiset, say) whose elements are cursors designating a family-name/(given-name/age) map. (Using cursors means you never have to duplicate data.) The cursors would be ordered according to family-name (that is, by the key that the cursor points to). Actually, there are probably many ways to do it. During the design of the container library, both the container and cursor types were declared as definite and non-limited specifically to facilitate the kinds of composition as in your example.