<?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/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"
  prev="2009/01/0eb7ca2a446affb91a9277e3c12af881"
  next="2009/01/0d27c84bbbe6b31d05561e311d1288eb"
  prev-in-thread="2009/01/0401a4d4b6d02ab9f2278e9afaf7a07b"
  next-in-thread="2009/01/38305d510cdda51c37c02c10a85c4db7"
  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>
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 )

2009/1/19 Jacques Carette &lt;carette@mcmaster.ca&gt;

&gt; Hugo Ferreira wrote:
&gt;
&gt;&gt; I am attempting to define a type so:
&gt;&gt;
&gt;&gt; type node =
&gt;&gt;  | Node of links
&gt;&gt;  | Leaf of int
&gt;&gt;
&gt;&gt; And I want to implement links as a
&gt;&gt; hashtable whose keys and values are
&gt;&gt; also of type node.
&gt;&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;

</contents>

</message>

