From: "snoopysalive" <matthias.kistler@gmx.de>
Subject: Re: How to use associative arrays in Ada 2005?
Date: 26 Nov 2006 11:05:54 -0800
Date: 2006-11-26T11:05:54-08:00 [thread overview]
Message-ID: <1164567954.228842.32980@h54g2000cwb.googlegroups.com> (raw)
In-Reply-To: upsbdhxlo.fsf@earthlink.net
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
next prev parent reply other threads:[~2006-11-26 19:05 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-21 10:11 How to use associative arrays in Ada 2005? snoopysalive
2006-11-21 11:49 ` Georg Bauhaus
2006-11-21 14:18 ` Matthew Heaney
2006-11-21 23:35 ` snoopysalive
2006-11-23 19:27 ` snoopysalive
2006-11-23 19:40 ` Georg Bauhaus
2006-11-24 0:33 ` Georg Bauhaus
2006-11-24 11:49 ` Matthew Heaney
2006-11-24 8:27 ` Dmitry A. Kazakov
2006-11-24 11:51 ` Matthew Heaney
2006-11-26 19:05 ` snoopysalive [this message]
2006-11-26 20:30 ` Matthew Heaney
2006-11-27 9:15 ` Dmitry A. Kazakov
2006-11-27 19:53 ` Matthew Heaney
2006-11-27 21:11 ` Dmitry A. Kazakov
2006-11-27 21:52 ` Matthew Heaney
2006-11-28 8:29 ` Alex R. Mosteo
2006-11-28 13:19 ` Matthew Heaney
2006-11-28 8:34 ` Dmitry A. Kazakov
2006-11-28 13:21 ` Matthew Heaney
2006-11-27 21:08 ` Simon Wright
2006-11-27 22:22 ` Matthew Heaney
2006-11-27 22:58 ` Simon Wright
2006-11-28 1:55 ` Matthew Heaney
2006-11-24 11:35 ` Matthew Heaney
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox