From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id CAA31928; Sun, 9 Nov 2003 02:13:50 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id CAA32061 for ; Sun, 9 Nov 2003 02:13:49 +0100 (MET) Received: from bob.west.spy.net (mail.west.spy.net [66.149.231.226]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hA91Dj103733 for ; Sun, 9 Nov 2003 02:13:48 +0100 (MET) Received: from [192.168.1.196] (dhcp-196.west.spy.net [192.168.1.196]) by bob.west.spy.net (Postfix) with ESMTP id 7CF825BF8 for ; Sat, 8 Nov 2003 17:13:42 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v606) In-Reply-To: <20031108091605.GC17239@fistandantilus.takhisis.org> References: <483F0AC5-1105-11D8-AC71-000393CFE6B8@spy.net> <20031107124619.GA14374@fistandantilus.takhisis.org> <8245A4CA-11C8-11D8-95B0-000393CFE6B8@spy.net> <20031108091605.GC17239@fistandantilus.takhisis.org> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Dustin Sallings Subject: Re: [Caml-list] removing an item from a list efficiently Date: Sat, 8 Nov 2003 17:13:42 -0800 To: Caml Mailing List X-Mailer: Apple Mail (2.606) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 doubly:01 hashtbl:01 prev:01 linked:01 linked:01 ocaml:01 mutable:01 mutable:01 nov:01 wrote:03 zacchiroli:03 recursive:03 types:03 data:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Nov 8, 2003, at 1:16, Stefano Zacchiroli wrote: > I still think that lists, no matter if single or doubly linked aren't a > good structure for your cache, anyway ... I'm using a Hashtbl for indexing the linked list which is used for maintaining the sequence. It should be O(1). >> type 'a link = Nothing | Link of 'a t;; >> type 'a t = { >> data: 'a; >> mutable prev: 'a link; >> mutable next: 'a link; >> };; >> But, link and t don't know about each other. How does one go about >> doing this kind of thing in ocaml? > > What do you mean? The above declaration isn't correct just because you > have to use an "and" instead of a "type" for the second declaration to > have two mutual recursive types. I don't know if this is really what > you're asking ... It is, thank you. The ``and'' thing was not obvious to me. Still learning. -- Dustin Sallings ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners