-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashcons.mli
54 lines (48 loc) · 1.48 KB
/
hashcons.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
(*
* hashcons: hash tables for hash consing
* Copyright (C) 2000 Jean-Christophe FILLIATRE
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU Library General Public License version 2 for more details
* (enclosed in the file LGPL).
*)
(*s Hash tables for hash consing. Hash consed values are of the
following type [hash_consed]. The field [tag] contains a unique
integer (for values hash consed with the same table). The field
[hkey] contains the hash key of the value (without modulo) for
possible use in other hash tables (and internally when hash
consing tables are resized). The field [node} contains the value
itself. *)
type 'a hash_consed = {
hkey : int;
tag : int;
node : 'a }
(*s Functorial interface. *)
module type HashedType =
sig
type t
val equal : t * t -> bool
val hash : t -> int
end
module type S =
sig
type key
type t
val create : int -> t
(*i
val clear : t -> unit
i*)
val hashcons : t -> key -> key hash_consed
(*i
val iter : (key hash_consed -> unit) -> t -> unit
val stat : t -> unit
i*)
end
module Make(H : HashedType) : (S with type key = H.t)