From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 9359DBB81 for ; Sat, 18 Dec 2004 16:28:01 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iBIFS1lX005276 for ; Sat, 18 Dec 2004 16:28:01 +0100 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 QAA09210 for ; Sat, 18 Dec 2004 16:28:00 +0100 (MET) Received: from annexia.force9.co.uk (annexia.force9.co.uk [212.56.101.183]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iBIFS0L7005273 for ; Sat, 18 Dec 2004 16:28:00 +0100 Received: from rich by annexia.force9.co.uk with local (Exim 3.36 #1 (Debian)) id 1CfgUx-0003Mg-00; Sat, 18 Dec 2004 15:27:59 +0000 Date: Sat, 18 Dec 2004 15:27:59 +0000 To: "chris.danx" Cc: caml-list@inria.fr Subject: Re: [Caml-list] Type problem... possible design problem Message-ID: <20041218152759.GA12095@annexia.org> References: <41C37CF7.5050400@ntlworld.com> <200412180807.05925.jon@jdh30.plus.com> <41C43E79.1040502@ntlworld.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vtzGhvizbBRQ85DL" Content-Disposition: inline In-Reply-To: <41C43E79.1040502@ntlworld.com> User-Agent: Mutt/1.5.6+20040722i From: Richard Jones X-Miltered: at concorde with ID 41C44C81.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41C44C80.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 wrote:01 variants:01 subgraphs:01 val:01 val:01 ...:98 lesson:98 node:01 node:01 leaf:01 leaf:01 int:01 int:01 tree:02 X-Attachments: type="application/pgp-signature" name="signature.asc" X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 18, 2004 at 02:28:09PM +0000, chris.danx wrote: > My concern with variants is sharing subgraphs in graphs, will they be=20 > shared or copied? A tree structure like this should be stored shared: type 'a tree =3D Leaf of 'a | Node of 'a tree list You can prove this; for instance: # let n =3D ref 1;; val n : int ref =3D {contents =3D 1} # let t =3D Leaf n;; =20 val t : int ref tree =3D Leaf {contents =3D 1} # let tree =3D Node [t; t];; val tree : int ref tree =3D Node [Leaf {contents =3D 1}; Leaf {contents =3D= 1}] # n :=3D 2;; - : unit =3D () # tree;; - : int ref tree =3D Node [Leaf {contents =3D 2}; Leaf {contents =3D 2}] Rich. --=20 Richard Jones. http://www.annexia.org/ http://www.j-london.com/ >>> http://www.team-notepad.com/ - collaboration tools for teams <<< Merjis Ltd. http://www.merjis.com/ - improving website return on investment http://subjectlink.com/ - Lesson plans and source material for teachers --vtzGhvizbBRQ85DL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBxEx/4le1M6q9pzoRAo21AKC7gv+1Qt9RpEfjhs16hPlbpDOQBACgha2f PmIYGsCoZDcRWD9OiI8PIyM= =QmrM -----END PGP SIGNATURE----- --vtzGhvizbBRQ85DL--