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,FREEMAIL_FROM, T_FILL_THIS_FORM_SHORT 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!postnews.google.com!h54g2000cwb.googlegroups.com!not-for-mail From: "snoopysalive" Newsgroups: comp.lang.ada Subject: Re: How to use associative arrays in Ada 2005? Date: 26 Nov 2006 11:05:54 -0800 Organization: http://groups.google.com Message-ID: <1164567954.228842.32980@h54g2000cwb.googlegroups.com> References: <1164103903.240838.37230@j44g2000cwa.googlegroups.com> <1164152113.623461.130190@e3g2000cwe.googlegroups.com> <1164310051.811802.237400@l12g2000cwl.googlegroups.com> <14xluht6idlik$.1cxod3mnfvcfs.dlg@40tude.net> NNTP-Posting-Host: 217.227.44.90 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1164567958 16606 127.0.0.1 (26 Nov 2006 19:05:58 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 26 Nov 2006 19:05:58 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Opera/9.02 (Macintosh; PPC Mac OS X; U; de),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: h54g2000cwb.googlegroups.com; posting-host=217.227.44.90; posting-account=1NtCpw0AAACqUfB6fMELOcl42bUe9ocw Xref: g2news2.google.com comp.lang.ada:7700 Date: 2006-11-26T11:05:54-08:00 List-Id: Hi! First, I want to thank all of you for your examples and ideas. But they don't work, sorry! So, I took your ideas and am trying to implement an own procedure creating "hashes" like I need them. The problem is that I need maps of maps of maps ... It's logical that a container is able to get another container as element and it's no problem to instanciate these containers and then put them one into the other. In my example code I tried to create a table of family names, names and their ages. Let's make it a little more complex and create another first key called "nation": Nation | Family Name | Name | Age* ----------|---------------|---------------------|------ German | Goethe | Johann Wolfgang | 60 | | Catharina Elisabeth | 80 | | Johann Caspar | 90 | Hesse | Hermann | 51 Japanese | Kusanagi | Motoko | 29 American | Ford | Henry | 45 | | Harrison | 41 Finnish | Torvalds | Linus | 35 ----------|---------------|---------------------------- * All ages are fictional because I don't know the real ages of these persons or they are dead or fictional The problem: Every single key needs a separate container map. We need 1 first-level, 4 second-level and 5 third-level key maps. First-level = 1x map of string-map Second-level = 4x map of string-map Third-level = 5x map of string-integer It would be necessary to create every single map and to put them one into the other all manually for transforming the given table into a "hash". That's easy and possible but not flexible. When posting the code of my impossible programme, I had the idea of "anonymous" container maps contained in maps. Because of this I wrote "Ages.Insert("family name", Insert("name", 23));". Sadly, Matt's solution didn't work. The statement "Ages.Insert ("family name", C, B);" brought a compilation error: "no selector 'Insert' for private type "Ada.Containers.Indefinite_Hashed_Maps.Map" from instance at line 16". I found out that no procedure "Insert(String, Cursor, Boolean)" exists. But it exists a procedure "Insert(String, Element_Type, Cursor, Boolean)". So, I'm trying to combine Matt's and Georg's ideas now. I'll write a line, if I'd be successfull. Otherwise, I'll also write a line. ;-) Once more: Thank you all. I'm commencing to have an idea of Ada-syntax and philosphy and that's more than my professors at universitiy could give me. Greetings, Matthias