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 JAA17187; Mon, 3 Jun 2002 09:03:44 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 JAA17292 for ; Mon, 3 Jun 2002 09:03:43 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g5373cv02175; Mon, 3 Jun 2002 09:03:38 +0200 (MET DST) Received: (from fpottier@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA17055; Mon, 3 Jun 2002 09:03:37 +0200 (MET DST) Date: Mon, 3 Jun 2002 09:03:37 +0200 From: Francois Pottier To: John Max Skaller Cc: =?iso-8859-1?Q?Fran=E7ois_Pottier?= , caml-list@inria.fr Subject: Re: [Caml-list] Hashtbl iter semantics Message-ID: <20020603090337.A16935@pauillac.inria.fr> Reply-To: Francois.Pottier@inria.fr References: <200205271904.VAA0000015105@beaune.inria.fr> <3CF5258C.3080409@ozemail.com.au> <20020530085315.A24997@pauillac.inria.fr> <3CF7B2E7.2030408@ozemail.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mutt 1.0i In-Reply-To: <3CF7B2E7.2030408@ozemail.com.au>; from skaller@ozemail.com.au on Sat, Jun 01, 2002 at 03:29:11AM +1000 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Thx. I'm using the Robinson algorithm at present: simple, but not efficient. > [And it doesn't match equi-recursive terms correctly .. I can't figure out > a fast way to minimise such a term .. hmmm.. linearise and use a > string matching algorithm ..?] I don't know Robinson's algorithm, but the usual way to perform unification in the presence of cyclic (equi-recursive) terms is to physically unify two nodes *before* looking at their sub-terms (instead of *after*, or not at all, in the non-cyclic case). This way, if you run into a cycle and you end up attempting to unify the same two nodes, you will succeed immediately, provided your first step is to check for physical equality. I can provide some sample code if that helps. That said, type inference in the presence of equi-recursive types is considered difficult for the user to figure out... many intuitively `meaningless' programs admit (weird) recursive types. -- François Pottier Francois.Pottier@inria.fr http://pauillac.inria.fr/~fpottier/ ------------------- 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