fixes and format

This commit is contained in:
Simon Cruanes 2024-11-15 11:02:38 -05:00
parent 8d8f1d4145
commit 6dcaddb7c6
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
4 changed files with 11 additions and 7 deletions

View file

@ -529,6 +529,10 @@ val all_ok : ('a, 'err) result t -> ('a t, 'err) result
@since 1.3, but only
@since 2.2 with labels *)
val split_result : ('ok, 'error) result list -> 'ok list * 'error list
(** Split a list of results into [Ok]s and [Error]s.
@since NEXT_RELEASE *)
val sorted_mem : cmp:(('a -> 'a -> int)[@keep_label]) -> 'a -> 'a list -> bool
(** [sorted_mem ~cmp x l] and [mem x l] give the same result for any sorted list [l],
but potentially more efficiently.

View file

@ -247,7 +247,8 @@ module Make (O : Set.OrderedType) = struct
let pp ?(pp_start = fun _ () -> ()) ?(pp_stop = fun _ () -> ())
?(pp_sep = fun fmt () -> Format.fprintf fmt ",@ ") pp_x fmt m =
let rec pp_mult ?(first = true) x n =
if n = 0 then ()
if n = 0 then
()
else (
if not first then pp_sep fmt ();
pp_x fmt x;
@ -256,8 +257,7 @@ module Make (O : Set.OrderedType) = struct
in
pp_start fmt ();
let first = ref true in
iter m
(fun x n ->
iter m (fun x n ->
if !first then
first := false
else