diff options
Diffstat (limited to 'clib')
| -rw-r--r-- | clib/cList.mli | 2 | ||||
| -rw-r--r-- | clib/cSig.mli | 1 | ||||
| -rw-r--r-- | clib/hMap.ml | 4 |
3 files changed, 6 insertions, 1 deletions
diff --git a/clib/cList.mli b/clib/cList.mli index 07f42770f9..c8e471f989 100644 --- a/clib/cList.mli +++ b/clib/cList.mli @@ -265,7 +265,7 @@ sig This is the second part of [chop]. *) val skipn_at_least : int -> 'a list -> 'a list - (** Same as [skipn] but returns [] if [n] is larger than the list of + (** Same as [skipn] but returns [] if [n] is larger than the length of the list. *) val drop_prefix : 'a eq -> 'a list -> 'a list -> 'a list diff --git a/clib/cSig.mli b/clib/cSig.mli index ca888f875a..1305be42bd 100644 --- a/clib/cSig.mli +++ b/clib/cSig.mli @@ -83,6 +83,7 @@ sig val min_binding: 'a t -> (key * 'a) val max_binding: 'a t -> (key * 'a) val choose: 'a t -> (key * 'a) + val choose_opt: 'a t -> (key * 'a) option val split: key -> 'a t -> 'a t * 'a option * 'a t val find: key -> 'a t -> 'a val find_opt : key -> 'a t -> 'a option diff --git a/clib/hMap.ml b/clib/hMap.ml index 3baa105fb0..210c48786b 100644 --- a/clib/hMap.ml +++ b/clib/hMap.ml @@ -356,6 +356,10 @@ struct let (_, m) = Int.Map.choose s in Map.choose m + let choose_opt s = + try Some (choose s) + with Not_found -> None + let find k s = let h = M.hash k in let m = Int.Map.find h s in |
