aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/cList.ml3
-rw-r--r--lib/cList.mli3
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/cList.ml b/lib/cList.ml
index 6559efd40a..140728242c 100644
--- a/lib/cList.ml
+++ b/lib/cList.ml
@@ -736,7 +736,8 @@ let rec assoc_f f a = function
| (x, e) :: xs -> if f a x then e else assoc_f f a xs
| [] -> raise Not_found
-let remove_assoc_f f a l = remove_first (fun (x,_) -> f a x) l
+let remove_assoc_f f a l =
+ try remove_first (fun (x,_) -> f a x) l with Not_found -> l
let mem_assoc_f f a l = List.exists (fun (x,_) -> f a x) l
diff --git a/lib/cList.mli b/lib/cList.mli
index 3968a4adf0..6b9f2a8c2d 100644
--- a/lib/cList.mli
+++ b/lib/cList.mli
@@ -160,7 +160,10 @@ sig
val for_all_i : (int -> 'a -> bool) -> int -> 'a list -> bool
val except : 'a eq -> 'a -> 'a list -> 'a list
val remove : 'a eq -> 'a -> 'a list -> 'a list
+
val remove_first : ('a -> bool) -> 'a list -> 'a list
+ (** Remove the first element satisfying a predicate, or raise [Not_found] *)
+
val for_all2eq : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
val sep_last : 'a list -> 'a * 'a list