comp.lang.ada
 help / color / mirror / Atom feed
From: David Trudgett <wpower@zeta.org.au.nospamplease>
Subject: Re: Hash table
Date: Sun, 14 Aug 2005 11:30:19 +1000
Date: 2005-08-14T11:30:19+10:00	[thread overview]
Message-ID: <m364u98fv8.fsf@rr.trudgett> (raw)
In-Reply-To: ur7cx4cen.fsf@earthlink.net


Hi Matthew,

Matthew Heaney <matthewjheaney@earthlink.net> writes:

> David Trudgett <wpower@zeta.org.au.nospamplease>  writes:
>
>> I'm looking for a Free Software Ada95 container library, or in
>> particular, a hash table (or associative list).
>
> Ada 2005 will have both sets and maps.  You're asking specifically for a
> hashed version, but keep in mind that an ordered container (having an

Yes, when I used those terms, I did so from the point of view of
someone with some experience in Perl and Common Lisp. 


> identical interface, but different time complexity) might satisfy your
> needs just as well.

Whether ordered or not is not really important for my current
immediate use, as you say. However, I knew that a container library
would generally provide various types for various uses.

While learning Ada, I am porting a simple Common Lisp program that I
wrote not long ago (partly based on a tutorial in a book) to play
computer vs human noughts and crosses.
(http://www.zeta.org.au/~wpower/dkt/programs/tictactoe.lisp) This
program makes use of simple associative lists for a couple of little
lookup jobs; hence the desire to find an Ada equivalent. I could just
use an array solution probably for something this simple, but it's a
learning exercise more than a practical application.


>
> If you don't have an Ada 2005 compiler, then you can modify the sources
> to your liking.  That will mean replacing an anonymous access subprogram
> parameters with something else, typically a generic operation that
> passes the subprogram as a generic formal.  For example, the procedure:
>
> procedure Iterate
>   (Container : in Map;
>    Process   : not null access procedure (Position : Cursor));
>
> should be re-written as:
>
> generic
>    with procedure Process (Position : Cursor);
> procedure Generic_Iteration (Container : in Map);
>
> (Note that replacing the anonymous access subprogram parameters with
> named access parameters is probably not what you want, because of the
> accessibility rules.  Hence the generic declaration above.)

As a newbie, all this is a bit over my head! ;-)


>
>
>> A bit of searching found the ASL (Ada Structured Library --
>> http://sourceforge.net/projects/adasl), which hasn't had a new release
>> since 2001 (which means it must be perfect ;-)). Should I use ASL, and
>> if I do, will it be completely different from the proposed
>> Ada.Containers standard?
>
> I would try to use a reference implementation of the standard library,
> modified as necessary to run under pure Ada 95.  I can help you make the
> necessary modifications.

Thanks for the offer of help. I was going to have a look at Charles
first and see how I go.


>
> In general, we prefer that users use the standard library now, since
> that helps us find bugs in the design of the library (early adopters
> have been extremely helpful here), and in the actual implementation of
> the library.

Well, I would like to be helpful if I can, and it would be good to get
some hands-on experience with the new container library (reference). I
may save it for when I know a bit more than I do now, though!


>
>
>> I'm using Gnat (3.15p) on Debian Linux.
>
> Do you have access to gcc 4.x?  The standard container library is
> already bundled with the gcc 4 release.

Yes, it's probably just an apt-get away, but one step at a time! ;-)
I'm also now in the midst of some system housekeeping work that
could'nt wait, so it might be a day or three before I get some more
time to work on this...  

Thanks for taking time to reply to my query.

David


-- 

David Trudgett
http://www.zeta.org.au/~wpower/

As for those who profit by the privileges gained by previous acts of
violence, they often forget and like to forget how these privileges
were obtained. But one need only recall the facts of history, not the
history of the exploits of different dynasties of rulers, but real
history, the history of the oppression of the majority by a small
number of men, to see that all the advantages the rich have over the
poor are based on nothing but flogging, imprisonment, and murder.

    -- Leo Tolstoy, "The Kingdom of God is Within You"



      reply	other threads:[~2005-08-14  1:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-13  0:43 Hash table David Trudgett
2005-08-13  9:23 ` Frank
2005-08-13 13:52 ` Ludovic Brenta
2005-08-14  0:23   ` David Trudgett
2005-08-14 22:42     ` Martin Dowie
2005-08-15  6:51       ` Martin Dowie
2005-08-15 15:47         ` Matthew Heaney
2005-08-16  7:33           ` Martin Dowie
2005-08-13 23:58 ` Matthew Heaney
2005-08-14  1:30   ` David Trudgett [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox