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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id C738FBBAF for ; Mon, 19 Jan 2009 20:36:38 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsIBALNkdEnVhjEYkWdsb2JhbACUBwEBAQEJCwoHEQO9NoVz X-IronPort-AV: E=Sophos;i="4.37,290,1231110000"; d="scan'208";a="19840486" Received: from ihsmtp02voda.lis.interhost.com (HELO ihsmtp02cons.lis.interhost.com) ([213.134.49.24]) by mail2-smtp-roc.national.inria.fr with ESMTP; 19 Jan 2009 20:36:38 +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 19:34:00 +0000 Message-ID: <4974D645.6050805@inescporto.pt> Date: Mon, 19 Jan 2009 19:36:37 +0000 From: Hugo Ferreira User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Thomas Gazagnaire Cc: Jacques Carette , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Defining type that requires hashtables with recursive definition References: <4974B7AA.9010004@inescporto.pt> <4974B98E.4020700@mcmaster.ca> <9722eaea0901191003j7bae9032r84e46ec0bb11ae3e@mail.gmail.com> In-Reply-To: <9722eaea0901191003j7bae9032r84e46ec0bb11ae3e@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 19 Jan 2009 19:34:00.0973 (UTC) FILETIME=[E12E3BD0:01C97A6C] X-Spam: no; 0.00; hashtables:01 recursive:01 recursive:01 hashtbl:01 hashedtype:01 struct:01 node:01 node:01 hash:01 hashtbl:01 hash:01 hashtable:01 beginner's:01 ocaml:01 bug:01 Thomas Gazagnaire wrote: > or if you really want to define your own equality, you can use recursive > modules: > > module rec H : Hashtbl.HashedType = > struct > type node = > | Node of node J.t > | Leaf of int > > type t = node > let equal (e1:node) (e2:node) = (==) e1 e2 > let hash (e:node) = Hashtbl.hash e > end > > and J : Hashtbl.S = Hashtbl.Make( H ) > Yes, looks like what I need. Thanks, Hugo F. > 2009/1/19 Jacques Carette > > > Hugo Ferreira wrote: > > 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. > > > type node = > | Node of links > | Leaf of int > and links = (node, node) Hashtbl.t > > should do it. > > Jacques > > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > >