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 TAA19660; Sat, 8 Nov 2003 19:00:04 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA19353 for ; Sat, 8 Nov 2003 19:00:03 +0100 (MET) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hA8I02120594 for ; Sat, 8 Nov 2003 19:00:02 +0100 (MET) Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id hA8HwQC20434; Sat, 8 Nov 2003 11:58:30 -0600 (CST) Date: Sat, 8 Nov 2003 12:57:16 -0600 (CST) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: Dustin Sallings cc: Stefano Zacchiroli , Caml Mailing List Subject: Re: [Caml-list] removing an item from a list efficiently In-Reply-To: <8245A4CA-11C8-11D8-95B0-000393CFE6B8@spy.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 prev:01 prev:01 ocaml:01 mutable:01 mutable:01 nov:01 redefine:02 wrote:03 data:03 data:03 redirect:95 brian:06 brian:06 source:07 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, 8 Nov 2003, Dustin Sallings wrote: > 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? > Use and: type 'a link = Nothing | Something of 'a t and 'a t = { data: 'a; mutable next: 'a link; mutable prev: 'a link } The other alternative is to not redefine option: type 'a t = { data: 'a; mutable next: 'a t option; mutable prev: 'a t option } Brian -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- 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