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,a644fa9cd1a3869a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-12 14:54:40 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjcppf01.usenetserver.com!usenetserver.com!news-west.rr.com!lsnws01.we.mediaone.net!typhoon.san.rr.com!not-for-mail Message-ID: <3BF05337.75BE0A18@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.2 References: <3BECA3B7.5020702@telepath.com> <3BF0247D.4500975E@san.rr.com> <5BXH7.22252$xS6.34813@www.newsranger.com> <3BF052D3.ECEF3FF2@san.rr.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Mon, 12 Nov 2001 22:55:05 GMT NNTP-Posting-Host: 66.75.151.160 X-Complaints-To: abuse@rr.com X-Trace: typhoon.san.rr.com 1005605705 66.75.151.160 (Mon, 12 Nov 2001 14:55:05 PST) NNTP-Posting-Date: Mon, 12 Nov 2001 14:55:05 PST Xref: archiver1.google.com comp.lang.ada:16379 Date: 2001-11-12T22:55:05+00:00 List-Id: Darren New wrote: > > Ted Dennison wrote: > > > I can't always read all parts of a MIME message w/ my regular newsreader. In > > this case, your spec came through as garbage. > > Sorry. MIME's been around for longer than Ada95, so I figured everyone > could handle it. The plaintext version is pasted at the bottom, then. Oops. generic type Element is private; package AdaLists is type List is private; type Location is private; -- List construction, as already specified function "&" (Left, Right : Element) return List; -- O(1) function "&" (Left : Element; Right : List) return List; -- O(Size(Right)) function "&" (Left : List; Right : Element) return List; -- O(Size(Left)) function "&" (Left, Right : List) return List; -- O(Size(Left)+Size(Right)) function "+" (Initial_Element : Element) return List; -- O(1) -- List access -- These should all be obvious, except for error cases. -- All of these raise No_Item if the specified item doesn't exist. -- I.e., front and back raise No_Item if Has_Item(L) is empty. -- Item raises No_Item if Size(L) head=null and tail=null -- Size=1 -> head=tail -- Size>1 -> head/=tail type List_Access is access List; type Location is record L : List_Access; -- What am I pointing into? Next, Prev : Link_Access; -- prev and next Curr : Link_Access; -- Do I have a current? end record; -- L.Size=0 -> next, prev, curr=nul -- Has_Item(this) -> Curr/=null -- Has_Next(this) -> Next/=null -- Has_Previous(this) -> Prev/=null -- It is possible by to add Invalid_Change to all Location -- operations that will catch using two locations into the -- same list and modifying them in ways that they invalidate -- the other, but that's additional overhead we might not want. -- It consists of basically adding a "change counter" to each -- location and list, incrementing both with each change, and -- then revalidating each location that refers to a list whose -- change counter doesn't match, eliminating most of the -- overhead for the normal case of only one location being -- manipulated at a time. end AdaLists; -- Darren New San Diego, CA, USA (PST). Cryptokeys on demand. You will soon read a generic fortune cookie.