Le 22/01/11 18:56, Andrew a écrit : >> let rec x = (1,y) and y = (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 = Lit(bool * string*form) | Conj(form*form*form) | Disj(form*form*form) let mkNot = function Lit(_,_,f) | Conj(_,_,f) | Disj(_,_,f) -> f let mkLit v = let rec v1 = Lit(true,v,v2) and v2 = Lit(false,v,v1) in v1 let mkConj f1 f2 = let rec v1 = Conj(f1,f2,v2) and v2 = Disj(mkNot f1, mkNot f2, v1) in v1 So the real question is what is the best way to hashcons this ? > Might be naïve curiosity, but how do you manage to build this? What's the > type of x and y? > > My Ocaml toplevel returns > # let rec x = (1,y) and y = (2,x);; > Characters 26-31: > let rec x = (1,y) and y = (2,x);; > ^^^^^ > Error: This expression has type int * (int * (int * 'a)) > but is here used with type int * 'a > > Andrew. > > -- 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 can check this signature. The public key is stored on www.keyserver.net ---------------------------------------------