From 4e5747adfd7b5c83cac2c4bb242d85fd3cb6fdd0 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Wed, 5 Mar 2014 20:14:51 +0100 Subject: Fixing previous commit. Forgot to include some code. --- lib/hMap.ml | 19 +++++++++++++++++++ lib/hMap.mli | 3 +++ 2 files changed, 22 insertions(+) (limited to 'lib') diff --git a/lib/hMap.ml b/lib/hMap.ml index cf5d0dfbcd..73cfbd0c71 100644 --- a/lib/hMap.ml +++ b/lib/hMap.ml @@ -258,6 +258,10 @@ struct let max_binding _ = assert false (** Cannot be implemented efficiently *) + let fold_left _ _ _ = assert false (** Cannot be implemented efficiently *) + + let fold_right _ _ _ = assert false (** Cannot be implemented efficiently *) + let choose s = let (_, m) = Int.Map.choose s in Map.choose m @@ -295,4 +299,19 @@ struct let m = Map.update k x m in Int.Map.update h m s + let smartmap f s = + let fs m = Map.smartmap f m in + Int.Map.smartmap fs s + + let smartmapi f s = + let fs m = Map.smartmapi f m in + Int.Map.smartmap fs s + + module Unsafe = + struct + let map f s = + let fs m = Map.Unsafe.map f m in + Int.Map.map fs s + end + end diff --git a/lib/hMap.mli b/lib/hMap.mli index 4519ba316a..45b722fda0 100644 --- a/lib/hMap.mli +++ b/lib/hMap.mli @@ -10,7 +10,10 @@ module type HashedType = sig type t val compare : t -> t -> int + (** Total ordering *) val hash : t -> int + (** Hashing function compatible with [compare], i.e. [compare x y = 0] implies + [hash x = hash y]. *) end (** Hash maps are maps that take advantage of having a hash on keys. This is -- cgit v1.2.3