From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id ABB0ABC88 for ; Wed, 9 Feb 2005 07:43:12 +0100 (CET) Received: from iona.labri.fr (iona.labri.fr [147.210.8.143]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j196hCv9029918 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 9 Feb 2005 07:43:12 +0100 Received: from localhost (guismo.drimm.u-bordeaux1.fr [147.210.36.243]) by iona.labri.fr (Postfix) with ESMTP id 1D8F91017A4; Wed, 9 Feb 2005 07:43:12 +0100 (CET) Received: from iona.labri.fr ([147.210.8.143]) by localhost (guismo [147.210.36.243]) (amavisd-new, port 10024) with LMTP id 05353-02-3; Wed, 9 Feb 2005 07:43:10 +0100 (CET) Received: by iona.labri.fr (Postfix, from userid 48) id B8AF3101767; Wed, 9 Feb 2005 07:43:10 +0100 (CET) Received: from ailleurs.labri.fr (ailleurs.labri.fr [147.210.9.222]) by mailhost.labri.fr (IMP) with HTTP for ; Wed, 9 Feb 2005 07:43:10 +0100 Message-ID: <1107931390.4209b0fea7f00@mailhost.labri.fr> Date: Wed, 9 Feb 2005 07:43:10 +0100 From: Pierre Casteran To: Jonathan Roewen Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Creating a tree type References: <200502071601.01981.jon@jdh30.plus.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.6 X-Originating-IP: 147.210.9.222 X-Virus-Scanned: amavisd-new at u-bordeaux1.fr X-Miltered: at nez-perce with ID 4209B100.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 wrote:01 wrote:01 stack:01 stack:01 hashtable:01 caml-list:01 beginner's:01 ocaml:01 beginners:01 bug:01 ...:98 ...:98 node:01 node:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Hello, Did you look at Huet's zippers ? http://caml.inria.fr/archives/200304/msg00202.html Pierre Selon Jonathan Roewen : > On Mon, 7 Feb 2005 16:01:01 +0000, Jon Harrop wrote: > > On Monday 07 February 2005 11:41, Jonathan Roewen wrote: > > > What would be the best approach to creating a tree type such that at > > > each node, it has some sort of reference to the parent node... > > > > Adding references to the parent of each node in a tree makes the data > > structure a graph and not a tree. > > > > This can be implemented in several ways. However, I strongly recommend that > > you do not do this to begin with, for several reasons: > > Okay, so I realised I could just use a Stack to track a walk through the > tree... > > A couple more questions though: > > 1. For the Stack, when I put something in it, is it copied or what? > How does that work? > > 2. How do I make my tree like a hashtable, i.e. modifications are done > in-place? Some sort of nested Map or something? Using lists to build > up the tree would cause pain when wanting to modify it. It would also > seem inefficient to use lists for this particular use case. > > Regards, > > Jonathan. > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- Pierre Casteran (+33) 540006931 ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.