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 KAA02052; Sat, 8 Nov 2003 10:16:09 +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 KAA02269 for ; Sat, 8 Nov 2003 10:16:08 +0100 (MET) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from vsmtp3.tin.it (vsmtp3.tin.it [212.216.176.223]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hA89G7123518 for ; Sat, 8 Nov 2003 10:16:08 +0100 (MET) Received: from dalamar.takhisis.org (80.180.182.244) by vsmtp3.tin.it (7.0.019) id 3F98DAEA0071318B for caml-list@inria.fr; Sat, 8 Nov 2003 10:16:07 +0100 Received: from fistandantilus.takhisis.org (fistandantilus.takhisis.org [192.168.1.113]) by dalamar.takhisis.org (Postfix) with ESMTP id D4677B79C for ; Sat, 8 Nov 2003 10:16:06 +0100 (CET) Received: by fistandantilus.takhisis.org (Postfix, from userid 3148) id E5694274025; Sat, 8 Nov 2003 10:16:05 +0100 (CET) Date: Sat, 8 Nov 2003 10:16:05 +0100 From: Stefano Zacchiroli To: Caml Mailing List Subject: Re: [Caml-list] removing an item from a list efficiently Message-ID: <20031108091605.GC17239@fistandantilus.takhisis.org> Mail-Followup-To: Caml Mailing List References: <483F0AC5-1105-11D8-AC71-000393CFE6B8@spy.net> <20031107124619.GA14374@fistandantilus.takhisis.org> <8245A4CA-11C8-11D8-95B0-000393CFE6B8@spy.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8245A4CA-11C8-11D8-95B0-000393CFE6B8@spy.net> User-Agent: Mutt/1.5.4i X-Loop: caml-list@inria.fr X-Spam: no; 0.00; bononia:01 caml-list:01 figuring:01 doubly:01 prev:01 bononia:01 mio:99 ero:99 reso:99 che:99 molto:99 dentro:99 linked:01 linked:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk [ Please don't Cc:-me, I'm subscribed to this list, as my Mail-Followup-To header can confirm ] On Sat, Nov 08, 2003 at 12:49:48AM -0800, Dustin Sallings wrote: > This is really what I was asking, whether ocaml lists could be > appropriate. > > I'm having difficulty figuring out how to implement a double linked > list, though. I want something like this: I still think that lists, no matter if single or doubly linked aren't a good structure for your cache, anyway ... > 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 ... Cheers. -- ^Stefano Zacchiroli -- Master in Computer Science @ Uni. Bologna, Italy$ ^zack@{cs.unibo.it,debian.org,bononia.it} -- http://www.bononia.it/zack$ ^Frequentando il mio maestro mi ero reso conto [.] che la logica poteva$ ^servire a molto a condizione di entrarci dentro e poi di uscirne -Adso$ ------------------- 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