From: mheaney@ni.net (Matthew Heaney)
Subject: Re: Array index ?
Date: 1998/01/29
Date: 1998-01-29T00:00:00+00:00 [thread overview]
Message-ID: <mheaney-ya023680002901982253280001@news.ni.net> (raw)
In-Reply-To: Pine.OSF.3.95.980129004337.31543A-100000@esus.cs.montana.edu
In article <Pine.OSF.3.95.980129004337.31543A-100000@esus.cs.montana.edu>,
SiliconJesus <softichj@cs.montana.edu> wrote:
>I am trying to write some code that allows me to make an array of records
>and I want the array to have index for a string of 4,so Array(Sock) like a
>warehouse storage type program, I know this should be trivial to me, but
>I've been coding in C++ and Java for a semester and have forgotten some of
>my Ada roots, any help would be appreciated.
Do you mean you want an array whose index subtype is a subtype of String, as in
subtype T_Index is String (1 .. 4);
type T is array (T_Index) of R;
If so, you can't do that, because arrays can only have a discrete subtype
(integer or enumeration type) as the index subtype.
You probably want a more abstract data structure, such as a dictionary
(sort of like a symbol table - consult you fave compiler book) or a
trie-structure (not a misspell) or a hash table, etc.
--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271
next prev parent reply other threads:[~1998-01-29 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-01-29 0:00 Array index ? SiliconJesus
1998-01-29 0:00 ` Matthew Heaney [this message]
1998-01-31 0:00 ` Nick Roberts
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox