File tree Expand file tree Collapse file tree 2 files changed +6
-18
lines changed Expand file tree Collapse file tree 2 files changed +6
-18
lines changed Original file line number Diff line number Diff line change @@ -475,21 +475,6 @@ let for_all p v =
475475
476476let member ~eq x v = exists (eq x) v
477477
478- let find_internal_ p v =
479- let n = v.size in
480- let rec check i =
481- if i = n then
482- raise_notrace Not_found
483- else (
484- let x = v.vec.(i) in
485- if p x then
486- x
487- else
488- check (i + 1 )
489- )
490- in
491- check 0
492-
493478let find_internal_i_ p v =
494479 let n = v.size in
495480 let rec check i =
@@ -505,8 +490,10 @@ let find_internal_i_ p v =
505490 in
506491 check 0
507492
508- let find_exn p v = try find_internal_ p v with Not_found -> raise Not_found
509- let find p v = try Some (find_internal_ p v) with Not_found -> None
493+ let find_exn p v =
494+ try snd (find_internal_i_ p v) with Not_found -> raise Not_found
495+
496+ let find p v = try Some (snd @@ find_internal_i_ p v) with Not_found -> None
510497let findi p v = try Some (find_internal_i_ p v) with Not_found -> None
511498
512499let find_map f v =
Original file line number Diff line number Diff line change @@ -221,7 +221,8 @@ val find : ('a -> bool) -> ('a, _) t -> 'a option
221221(* * Find an element that satisfies the predicate. *)
222222
223223val findi : ('a -> bool ) -> ('a , _ ) t -> (int * 'a ) option
224- (* * Find an element and its index that satisfies the predicate. *)
224+ (* * Find an element and its index that satisfies the predicate.
225+ @since NEXT_RELEASE *)
225226
226227val find_exn : ('a -> bool ) -> ('a , _ ) t -> 'a
227228(* * Find an element that satisfies the predicate, or
You can’t perform that action at this time.
0 commit comments