Browse thread
Defining type that requires hashtables with recursive definition
- Hugo Ferreira
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2009-01-19 (17:26) |
From: | Hugo Ferreira <hmf@i...> |
Subject: | Defining type that requires hashtables with recursive definition |
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.