From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id EA55ABC8B for ; Mon, 7 Feb 2005 12:41:38 +0100 (CET) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.194]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j17BfcIR000452 for ; Mon, 7 Feb 2005 12:41:38 +0100 Received: by rproxy.gmail.com with SMTP id i8so607989rne for ; Mon, 07 Feb 2005 03:41:37 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=S10o7mP16zu/PMO2GlORaKOvwD0e3ILr8FR3IMSRT1x5mX5gPYZ3ZnAn/3hQOCUg1/gffcbMHyw33XYyySD+QemtkMpgf3oMwU+wpwagmpuapGpZxz9fNtFQORPF4e6h/TnU6x7/SOcC0gVkqmY9FA8IaDqUWJCbHBcH7mX78MU= Received: by 10.38.15.5 with SMTP id 5mr10979rno; Mon, 07 Feb 2005 03:41:37 -0800 (PST) Received: by 10.38.209.53 with HTTP; Mon, 7 Feb 2005 03:41:37 -0800 (PST) Message-ID: Date: Tue, 8 Feb 2005 00:41:37 +1300 From: Jonathan Roewen Reply-To: Jonathan Roewen To: caml-list@yquem.inria.fr Subject: [Caml-list] Creating a tree type Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 420753F2.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml's:01 nodes:01 recursive:01 defintion:01 ocaml:01 ocaml:01 node:01 node:01 leaf:01 tree:02 tree:02 root:03 ugly:03 approach:07 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=RCVD_BY_IP autolearn=disabled version=3.0.2 X-Spam-Level: Hi, 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? Is this an example of when ocaml's OO side would be more useful? Basically, I'm creating a UI for my OS; since events will typically bubble from leaf nodes up through their ancestors until either the event has been handled or have reached the root node, being able to reference the parent node efficiently (and easily) is a requirement. I've tried a recursive type, but both the defintion and code to make use of it is damn ugly and complicated--there just has to be a better way to do this sort of thing nicely in ocaml. Regards, Jonathan Roewen -- Desert Spring-Time: An OCaml OS -- http://www.purevoid.org/os/progress/