stdcompat__ephemeron.ml1 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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177include Ephemeron (* module type S = sig type key type !'a t (* type 'a t *) val create : int -> 'a t val clear : 'a t -> unit val reset : 'a t -> unit val copy : 'a t -> 'a t val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit val mem : 'a t -> key -> bool val length : 'a t -> int val stats : 'a t -> Stdcompat__hashtbl.statistics val add_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit val replace_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t val clean : 'a t -> unit val stats_alive : 'a t -> Stdcompat__hashtbl.statistics end module type SeededS = sig type key type !'a t (* type 'a t *) val create : ?random:bool -> int -> 'a t val clear : 'a t -> unit val reset : 'a t -> unit val copy : 'a t -> 'a t val add : 'a t -> key -> 'a -> unit val remove : 'a t -> key -> unit val find : 'a t -> key -> 'a val find_opt : 'a t -> key -> 'a option val find_all : 'a t -> key -> 'a list val replace : 'a t -> key -> 'a -> unit val mem : 'a t -> key -> bool val length : 'a t -> int val stats : 'a t -> Stdcompat__hashtbl.statistics val add_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit val replace_seq : 'a t -> (key * 'a) Stdcompat__seq.t -> unit val of_seq : (key * 'a) Stdcompat__seq.t -> 'a t val clean : 'a t -> unit val stats_alive : 'a t -> Stdcompat__hashtbl.statistics end let not_implemented () = failwith "Stdcompat.Ephemeron is not implemented yet. Please fill an issue: https://github.com/thierry-martinez/stdcompat/issues ." module K1 = struct type ('k, 'd) t let make _ = not_implemented () let query _ = not_implemented () module Make (H : Hashtbl.HashedType) = struct include Stdcompat__hashtbl.Make (H) let clean _ = not_implemented () let stats_alive _ = not_implemented () end module MakeSeeded (H : Stdcompat__hashtbl.SeededHashedType) = struct include Stdcompat__hashtbl.MakeSeeded (H) let clean _ = not_implemented () let stats_alive _ = not_implemented () end module Bucket = struct type ('k, 'd) t let make _ = not_implemented () let add _ = not_implemented () let remove _ = not_implemented () let find _ = not_implemented () let length _ = not_implemented () let clear _ = not_implemented () end end module K2 = struct type ('k1, 'k2, 'd) t let make _ = not_implemented () let query _ = not_implemented () module Make (H1 : Hashtbl.HashedType) (H2 : Hashtbl.HashedType) = struct include Stdcompat__hashtbl.Make (struct type t = H1.t * H2.t let equal (x1, x2) (y1, y2) = H1.equal x1 y1 && H2.equal x2 y2 let hash (x, y) = Hashtbl.hash (H1.hash x, H2.hash y) end) let clean _ = not_implemented () let stats_alive _ = not_implemented () end module MakeSeeded (H1 : Stdcompat__hashtbl.SeededHashedType) (H2 : Stdcompat__hashtbl.SeededHashedType) = struct include Stdcompat__hashtbl.MakeSeeded (struct type t = H1.t * H2.t let equal (x1, x2) (y1, y2) = H1.equal x1 y1 && H2.equal x2 y2 let seeded_hash seed (x, y) = Stdcompat__hashtbl.seeded_hash seed (H1.seeded_hash seed x, H2.seeded_hash seed y) end) let clean _ = not_implemented () let stats_alive _ = not_implemented () end module Bucket = struct type ('k1, 'k2, 'd) t let make _ = not_implemented () let add _ = not_implemented () let remove _ = not_implemented () let find _ = not_implemented () let length _ = not_implemented () let clear _ = not_implemented () end end module Kn = struct type ('k, 'd) t let make _ = not_implemented () let query _ = not_implemented () module Make (H : Hashtbl.HashedType) = struct include Stdcompat__hashtbl.Make (struct type t = H.t array let equal x y = let rec check i = i >= Array.length x || H.equal x.(i) y.(i) && check (succ i) in Array.length x = Array.length y && check 0 let hash x = Hashtbl.hash (Array.map H.hash x) end) let clean _ = not_implemented () let stats_alive _ = not_implemented () end module MakeSeeded (H : Stdcompat__hashtbl.SeededHashedType) = struct include Stdcompat__hashtbl.MakeSeeded (struct type t = H.t array let equal x y = let rec check i = i >= Array.length x || H.equal x.(i) y.(i) && check (succ i) in Array.length x = Array.length y && check 0 let seeded_hash seed x = Stdcompat__hashtbl.seeded_hash seed (Array.map (H.seeded_hash seed) x) end) let clean _ = not_implemented () let stats_alive _ = not_implemented () end module Bucket = struct type ('k, 'd) t let make _ = not_implemented () let add _ = not_implemented () let remove _ = not_implemented () let find _ = not_implemented () let length _ = not_implemented () let clear _ = not_implemented () end end *)