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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,842accb6a7d76669 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-02 13:19:43 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!cpk-news-hub1.bbnplanet.com!news.gtei.net!newsfeed1.cidera.com!Cidera!cyclone1.gnilink.net!news-east.rr.com!news-west.rr.com!lsnws01.we.mediaone.net!typhoon.san.rr.com!not-for-mail Message-ID: <3BE30DF7.3F2E6698@san.rr.com> From: Darren New Organization: Boxes! X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: List container strawman 1.1 References: <3BE301D1.4010106@telepath.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 02 Nov 2001 21:20:05 GMT NNTP-Posting-Host: 66.75.151.160 X-Complaints-To: abuse@rr.com X-Trace: typhoon.san.rr.com 1004736005 66.75.151.160 (Fri, 02 Nov 2001 13:20:05 PST) NNTP-Posting-Date: Fri, 02 Nov 2001 13:20:05 PST Xref: archiver1.google.com comp.lang.ada:15702 Date: 2001-11-02T21:20:05+00:00 List-Id: Ted Dennison wrote: > -- Remove the element at the given location, and advance Location to > the next > -- element. > -- If Location=Done_Iterating then No_Item will be raised. > -- If Location=First, then Location will be set to the new First. > -- If Location=Last, then Location will be set to Done_Iterating. One problem with this is removing (say) the last three elements from a list. Since you always assume you want to go forward, it is more difficult to remove the last three than the first three, particularly since "Next" and "Previous" aren't functions. One possibility: Removing the last element returns the new Last, unless the list is now empty. Another possibility: Have two iterator values, "off front" and "off back", rather than just "done iterating". Actually, this would probably be better as Function No_Next(I : in Iterator) return Boolean; Function No_Previous(I : in Iterator) return Boolean; Function No_Item(I : in Iterator) return Boolean; Then you could have things like "Insert_Before", "Insert_After", and "Insert". "Insert" would take an iterator and insert the value at the iterator, so now the iterator points to it. "Remove" would take an interator and return the new iterator. You could still call "Previous" on an iterator that has "No_Next", and vica versa, so deleting the end item isn't a problem. You'd also have an iterator that is No_Item(i)=True, so you would have to move it one way or the other to find out where you are. Adding an "Insert_Sorted" function that parallels the sort function would allow the same structure to be used to maintain sorted lists. Hmmm... Maybe I should write up a whole counterproposal kind of thing, just to see how it flies? -- Darren New San Diego, CA, USA (PST). Cryptokeys on demand. Sore feet from standing in line at airport security checkpoints: Jet Leg.