From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p0MJfrlf002760 for ; Sat, 22 Jan 2011 20:41:53 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AngBACPBOk3UGyoFkWdsb2JhbACEE6BbFQEBAQEJCwoHEQMhrQuPfYRcdASKVIQM X-IronPort-AV: E=Sophos;i="4.60,363,1291590000"; d="asc'?vcf'?scan'208";a="96252677" Received: from smtp5-g21.free.fr ([212.27.42.5]) by mail1-smtp-roc.national.inria.fr with ESMTP; 22 Jan 2011 20:41:47 +0100 Received: from Tocksi.local (unknown [78.240.16.62]) by smtp5-g21.free.fr (Postfix) with ESMTP id 1611ED480B3; Sat, 22 Jan 2011 20:41:40 +0100 (CET) Message-ID: <4D3B32F0.6080107@univ-savoie.fr> Date: Sat, 22 Jan 2011 20:41:36 +0100 From: Christophe Raffalli User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; fr; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: Andrew , Caml Mailing List References: <4D3B05E6.3090103@univ-savoie.fr> <4d3b1a5d.ccefd80a.600d.177e@mx.google.com> In-Reply-To: <4d3b1a5d.ccefd80a.600d.177e@mx.google.com> X-Enigmail-Version: 1.1.1 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig2E417398DBAFCC3A14B1E12F" Subject: Re: [Caml-list] Weak array semantics with mutually recursive values. This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig2E417398DBAFCC3A14B1E12F Content-Type: multipart/mixed; boundary="------------010602060704090602030806" This is a multi-part message in MIME format. --------------010602060704090602030806 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Le 22/01/11 18:56, Andrew a =E9crit : >> let rec x =3D (1,y) and y =3D (2,x) This was just a silly example, but -rectypes works in that case. My real example is a type for hashconsed propositional formula each formula pointing to its negation like this (ignoring hashconsing): this is untested ... type form =3D Lit(bool * string*form) | Conj(form*form*form) | Disj(form*form*form) let mkNot =3D function Lit(_,_,f) | Conj(_,_,f) | Disj(_,_,f) -> f let mkLit v =3D let rec v1 =3D Lit(true,v,v2) and v2 =3D Lit(false,v,v1) in v1 let mkConj f1 f2 =3D let rec v1 =3D Conj(f1,f2,v2) and v2 =3D Disj(mkNot f1, mkNot f2, v1) in = v1 So the real question is what is the best way to hashcons this ? > Might be na=EFve curiosity, but how do you manage to build this? What's t= he > type of x and y? > > My Ocaml toplevel returns=20 > # let rec x =3D (1,y) and y =3D (2,x);; > Characters 26-31: > let rec x =3D (1,y) and y =3D (2,x);; > ^^^^^ > Error: This expression has type int * (int * (int * 'a)) > but is here used with type int * 'a > > Andrew. > > --=20 Christophe Raffalli Universite de Savoie Batiment Le Chablais, bureau 21 73376 Le Bourget-du-Lac Cedex tel: (33) 4 79 75 81 03 fax: (33) 4 79 75 87 42 mail: Christophe.Raffalli@univ-savoie.fr www: http://www.lama.univ-savoie.fr/~RAFFALLI --------------------------------------------- IMPORTANT: this mail is signed using PGP/MIME At least Enigmail/Mozilla, mutt or evolution=20 can check this signature. The public key is stored on www.keyserver.net --------------------------------------------- --------------010602060704090602030806 Content-Type: text/x-vcard; charset=utf-8; name="Christophe_Raffalli.vcf" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Christophe_Raffalli.vcf" begin:vcard fn:Christophe Raffalli n:Raffalli;Christophe org:LAMA (UMR 5127) email;internet:christophe.raffalli@univ-savoie.fr title;quoted-printable:Ma=3DC3=3DAEtre de conf=3DC3=3DA9rences tel;work:+33 4 79 75 81 03 note:http://www.lama.univ-savoie.fr/~raffalli x-mozilla-html:TRUE version:2.1 end:vcard --------------010602060704090602030806-- --------------enig2E417398DBAFCC3A14B1E12F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFNOzLzi9jr/RgYAS4RAkiVAKDOBVZ2ZZLCarFK8FAsXpaQRDzVzACfa2ls QwH6WlFTDGDUB+si/RLbiEA= =5PwT -----END PGP SIGNATURE----- --------------enig2E417398DBAFCC3A14B1E12F--