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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a644fa9cd1a3869a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-13 11:28:27 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!logbridge.uoregon.edu!dispose.news.demon.net!demon!grolier!freenix!enst!enst.fr!not-for-mail From: "Steven Deller" Newsgroups: comp.lang.ada Subject: RE: List container: Insert and Delete Date: Tue, 13 Nov 2001 14:25:43 -0500 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1005679706 7036 137.194.161.2 (13 Nov 2001 19:28:26 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Tue, 13 Nov 2001 19:28:26 +0000 (UTC) To: Return-Path: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 Importance: Normal In-Reply-To: <3BF15C70.B7EF23E6@san.rr.com> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:16436 Date: 2001-11-13T14:25:43-05:00 > -----Original Message----- > From: comp.lang.ada-admin@ada.eu.org > [mailto:comp.lang.ada-admin@ada.eu.org] On Behalf Of Darren New > Sent: Tuesday, November 13, 2001 12:47 PM > To: comp.lang.ada@ada.eu.org > Subject: Re: List container: Insert and Delete > > > Ted Dennison wrote: > > Should we remove all basic-looking routines from either > implementation > > with time behavior >=O(N). > > Definitely not. All that will do is force people to recreate > the functionality they need anyway, except without the > benefit of being able to access the internal structures. > > For example, I strongly suggest that there be a mechanism to > translate between positions and integer offsets and back. > This is an O(N) operation, obviously, compared to the O(1) of > moving the position. However, if someone has a list that they > want to stuff out to a file, along with an offset (say, the > one currently on the screen), they need a way to handle that. > Denying the ability to translate between positions and > integers just means that someone's going to write code full > of things like > offset := offset + 1; > pos := Next(pos); I wouldn't object to a function subtype position_index is natural ; head_position : constant position_index := 0 ; function offset (pos) return position_index ; that returns the current index. Done right, this index can be maintained as part of "pos", even in the face of insertions, and deletions. All in O(1) time. I do object to making a List into a Map (and a Map limited to a particular index type at that). Please don't add array indexing to lists. Regards, Steve Deller Smooth Sailing LLC