From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA14181; Thu, 25 Apr 2002 15:31:27 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA14149 for ; Thu, 25 Apr 2002 15:31:26 +0200 (MET DST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g3PDVQr11282 for ; Thu, 25 Apr 2002 15:31:26 +0200 (MET DST) Received: from foobar.pps.jussieu.fr (IDENT:root@helium.pps.jussieu.fr [134.157.168.2]) by shiva.jussieu.fr (8.12.3/jtpda-5.4) with ESMTP id g3PDVOT4083307 ; Thu, 25 Apr 2002 15:31:25 +0200 (CEST) Received: from strontium.pps.jussieu.fr (mail@strontium.pps.jussieu.fr [134.157.168.38]) by foobar.pps.jussieu.fr (8.11.0/jtpda-5.3.2) with ESMTP id g3PDedn12831 ; Thu, 25 Apr 2002 15:40:39 +0200 Received: from vouillon by strontium.pps.jussieu.fr with local (Exim 3.35 #1 (Debian)) id 170jLI-0001HB-00; Thu, 25 Apr 2002 15:31:24 +0200 Date: Thu, 25 Apr 2002 15:31:23 +0200 To: John Max Skaller Cc: caml-list@inria.fr Subject: Re: [Caml-list] How to compare recursive types? Solution! Message-ID: <20020425133123.GB4702@strontium.pps.jussieu.fr> References: <3CBD4523.6080707@ozemail.com.au> <87y9fmr4fo.dlv@wanadoo.fr> <3CC656E1.5020108@ozemail.com.au> <3CC675D7.40ADAD0F@ps.uni-sb.de> <3CC6AF9F.5040801@ozemail.com.au> <3CC6C986.A32F40F7@ps.uni-sb.de> <3CC757B2.7030706@ozemail.com.au> <3CC78908.7050507@ozemail.com.au> <3CC7AA30.4080700@ozemail.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3CC7AA30.4080700@ozemail.com.au> User-Agent: Mutt/1.3.28i From: Jerome Vouillon Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, Apr 25, 2002 at 05:03:12PM +1000, John Max Skaller wrote: > Basically, I normalise the type terms and use ocamls polymorphic > equality operator! The normalisation involves counting what > *real* level of the tree the recursive descent is in -- add one for > each binary Pair node. Each typedef name substituted along > the branch is tracked in an association list along with its level. > When a typedef name is encountered that is in this list, > replace it with Fix n, where n is the associated level number: > this uniquely determines the recursion argument. Assume the following definition: typedef y = int * y; Then "y" and "int * y" are not equal according to your algorithm. Is it what you expect? Why don't you make the pointers explicit in the type? Then, the two types definitions below would not define the same type typedef x = ref(x) * int; typedef y = (ref(y) * int) * int; while these two would define the same type typedef x = ref(x) * int; typedef y = ref(ref(y) * int) * int; -- Jerome ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners