comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <nickroberts@adaos.worldonline.co.uk>
Subject: Re: List Container Straw Man (NJR V5R1)
Date: Fri, 30 Nov 2001 22:05:51 -0000
Date: 2001-11-30T22:05:51+00:00	[thread overview]
Message-ID: <9u91u3$71h5k$1@ID-25716.news.dfncis.de> (raw)
In-Reply-To: 3C07BCEB.86878310@boeing.com

"Jeffrey Carter" <jeffrey.carter@boeing.com> wrote in message
news:3C07BCEB.86878310@boeing.com...
> Note that my comments on 7
>
> "[list elements must not be private] List elements must be limited
> private."
>
> are misleading, since they were made on the modified version
>
> "List elements must not be limited private"

Sorry. What, then, is your comment on the requirement:

List elements must be limited private.

please?

> As to mimicking Ada.Strings.*, abstract strings are a special case of
> unbounded arrays, not of lists, as they don't provide O(1) insertion and
> deletion.
>
> In order to be general, operations taking an array of elements would
> have to be generic, so that the client may specify the array type. These
> are easy enough for the client to implement with the basic operations,
> so I doubt if they're worth the trouble of providing.

I provided a specific array type, and corresponding insertion and
replacement operations, primarily for situations where it would be
particularly convenient for the programmer to construct an array aggregate.

Supposing one wanted to append a specific gene sequence (to concoct an
example) to a piece of DNA:

   Append( Seq_1, (Ad, Gu, Gu, Ad, Gu, Gu, Gu, Ad, Ad, Gu));

Doing this without the array type and operations would be less convenient,
possibly less readable, and probably less efficient.

An array of a different type (but with the same index and component types)
can be converted:

   type Gene_Array is (Positive range <>) of DNA_Gene_Marker;

   package Gene_Lists is new SCL.Lists.Unbounded(DNA_Gene_Marker);
   use Gene_Lists;

   ...

   Extra_1: constant Gene_Array :=
      (Ad, Gu, Gu, Ad, Gu, Gu, Gu, Ad, Ad, Gu);

   ...

   Append( Seq_1, Gene_Lists.Element_Array(Extra_1) );

Not pretty, but not too awful.

But certainly the array type and operations are only a convenience feature,
and could be removed without ruining the usefulness of the overall thing.

--
Best wishes,
Nick Roberts







  reply	other threads:[~2001-11-30 22:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-29 21:46 List Container Straw Man (NJR V5R1) Nick Roberts
2001-11-29 21:59 ` Nick Roberts
2001-11-30  1:51   ` Nick Roberts
2001-11-30  1:58 ` Jeffrey Carter
2001-11-30 17:07 ` Jeffrey Carter
2001-11-30 22:05   ` Nick Roberts [this message]
2001-12-01  2:12     ` Jeffrey Carter
2001-12-01  3:10       ` Nick Roberts
2001-12-05 13:04 ` John English
2001-12-06 17:36   ` 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