<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2009/01/38305d510cdda51c37c02c10a85c4db7"
  from="Hugo Ferreira &lt;hmf@i...&gt;"
  author="Hugo Ferreira"
  date="2009-01-19T19:36:38"
  subject="Re: [Caml-list] Defining type that requires hashtables with recursive definition"
  prev="2009/01/0d27c84bbbe6b31d05561e311d1288eb"
  next="2009/01/ae17c2a5c6ecb959567756983d8095a1"
  prev-in-thread="2009/01/eb6831715abd9119a3ef7546f61fe138"
  next-in-thread="2009/01/579dd5557b1f6515bd0fd1279ff0f1ff"
  prev-thread="2009/01/f038b8a453e89bfa6350495a826080fe"
  next-thread="2009/01/ae17c2a5c6ecb959567756983d8095a1"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="Defining type that requires hashtables with recursive definition ">
<msg 
  url="2009/01/000cddff1b409b39cd14cc392083ce8a"
  from="Hugo Ferreira &lt;hmf@i...&gt;"
  author="Hugo Ferreira"
  date="2009-01-19T17:26:18"
  subject="Defining type that requires hashtables with recursive definition ">
<msg 
  url="2009/01/0401a4d4b6d02ab9f2278e9afaf7a07b"
  from="Jacques Carette &lt;carette@m...&gt;"
  author="Jacques Carette"
  date="2009-01-19T17:35:14"
  subject="Re: [Caml-list] Defining type that requires hashtables with recursive definition">
<msg 
  url="2009/01/eb6831715abd9119a3ef7546f61fe138"
  from="Thomas Gazagnaire &lt;ocaml@g...&gt;"
  author="Thomas Gazagnaire"
  date="2009-01-19T18:09:44"
  subject="Re: [Caml-list] Defining type that requires hashtables with recursive  definition">
<msg 
  url="2009/01/38305d510cdda51c37c02c10a85c4db7"
  from="Hugo Ferreira &lt;hmf@i...&gt;"
  author="Hugo Ferreira"
  date="2009-01-19T19:36:38"
  subject="Re: [Caml-list] Defining type that requires hashtables with recursive definition">
</msg>
<msg 
  url="2009/01/579dd5557b1f6515bd0fd1279ff0f1ff"
  from="Hugo Ferreira &lt;hmf@i...&gt;"
  author="Hugo Ferreira"
  date="2009-01-20T10:09:33"
  subject="Re: [Caml-list] Defining type that requires hashtables with recursive definition">
</msg>
</msg>
<msg 
  url="2009/01/0d27c84bbbe6b31d05561e311d1288eb"
  from="Hugo Ferreira &lt;hmf@i...&gt;"
  author="Hugo Ferreira"
  date="2009-01-19T19:34:41"
  subject="Re: [Caml-list] Defining type that requires hashtables with recursive definition">
</msg>
</msg>
</msg>
</thread>

<contents>

Thomas Gazagnaire wrote:
&gt; or if you really want to define your own equality, you can use recursive 
&gt; modules:
&gt; 
&gt; module rec H : Hashtbl.HashedType =
&gt; struct
&gt;     type node =
&gt;         | Node of node J.t
&gt;         | Leaf of int
&gt; 
&gt;     type t = node
&gt;     let equal (e1:node) (e2:node) = (==) e1 e2
&gt;     let hash (e:node) = Hashtbl.hash e
&gt; end
&gt; 
&gt; and J : Hashtbl.S = Hashtbl.Make( H )
&gt;

Yes, looks like what I need.

Thanks,
Hugo F.



&gt; 2009/1/19 Jacques Carette &lt;carette@mcmaster.ca &lt;mailto:carette@mcmaster.ca&gt;&gt;
&gt; 
&gt;     Hugo Ferreira wrote:
&gt; 
&gt;         I am attempting to define a type so:
&gt; 
&gt;         type node =
&gt;          | Node of links
&gt;          | Leaf of int
&gt; 
&gt;         And I want to implement links as a
&gt;         hashtable whose keys and values are
&gt;         also of type node.
&gt; 
&gt; 
&gt;     type node =
&gt;      | Node of links
&gt;      | Leaf of int
&gt;     and links = (node, node) Hashtbl.t
&gt; 
&gt;     should do it.
&gt; 
&gt;     Jacques
&gt; 
&gt; 
&gt;     _______________________________________________
&gt;     Caml-list mailing list. Subscription management:
&gt;     http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
&gt;     Archives: http://caml.inria.fr
&gt;     Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
&gt;     Bug reports: http://caml.inria.fr/bin/caml-bugs
&gt; 
&gt; 

</contents>

</message>

