From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.6 required=5.0 tests=AWL,SPF_SOFTFAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 52FACBBAF for ; Mon, 19 Jan 2009 18:26:18 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsIBAPFGdEnVhjEYkWdsb2JhbACUBwEBAQEJCwoHEQO+JoVz X-IronPort-AV: E=Sophos;i="4.37,290,1231110000"; d="scan'208";a="21712037" Received: from ihsmtp02voda.lis.interhost.com (HELO ihsmtp02cons.lis.interhost.com) ([213.134.49.24]) by mail3-smtp-sop.national.inria.fr with ESMTP; 19 Jan 2009 18:26:08 +0100 Received: from [192.168.1.64] ([77.54.249.136]) by ihsmtp02cons.lis.interhost.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 19 Jan 2009 17:23:29 +0000 Message-ID: <4974B7AA.9010004@inescporto.pt> Date: Mon, 19 Jan 2009 17:26:02 +0000 From: Hugo Ferreira User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Defining type that requires hashtables with recursive definition Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 19 Jan 2009 17:23:30.0010 (UTC) FILETIME=[A5901BA0:01C97A5A] X-Spam: no; 0.00; hashtables:01 recursive:01 node:01 node:01 hashtable:01 struct:01 hash:01 hashtbl:01 hash:01 hashtbl:01 recursive:01 hashtable:01 int:01 define:02 defining:02 Hello, I am attempting to define a type so: type node = | Node of links | Leaf of int And I want to implement links as a hashtable whose keys and values are also of type node. Note that the idea is to use object address comparison for the keys so: module H = struct type t = node let equal (e1:node) (e2:node) = (==) e1 e2 let hash (e:node) = Hashtbl.hash e end module J = Hashtbl.Make( H ) However this requires a recursive definition on the hashtable. How may a declare node and hashtable to allow this? TIA, Hugo F.