mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
fixes and format
This commit is contained in:
parent
8d8f1d4145
commit
6dcaddb7c6
4 changed files with 11 additions and 7 deletions
|
|
@ -529,6 +529,10 @@ val all_ok : ('a, 'err) result t -> ('a t, 'err) result
|
||||||
@since 1.3, but only
|
@since 1.3, but only
|
||||||
@since 2.2 with labels *)
|
@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
|
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],
|
(** [sorted_mem ~cmp x l] and [mem x l] give the same result for any sorted list [l],
|
||||||
but potentially more efficiently.
|
but potentially more efficiently.
|
||||||
|
|
|
||||||
|
|
@ -247,17 +247,17 @@ module Make (O : Set.OrderedType) = struct
|
||||||
let pp ?(pp_start = fun _ () -> ()) ?(pp_stop = fun _ () -> ())
|
let pp ?(pp_start = fun _ () -> ()) ?(pp_stop = fun _ () -> ())
|
||||||
?(pp_sep = fun fmt () -> Format.fprintf fmt ",@ ") pp_x fmt m =
|
?(pp_sep = fun fmt () -> Format.fprintf fmt ",@ ") pp_x fmt m =
|
||||||
let rec pp_mult ?(first = true) x n =
|
let rec pp_mult ?(first = true) x n =
|
||||||
if n = 0 then ()
|
if n = 0 then
|
||||||
|
()
|
||||||
else (
|
else (
|
||||||
if not first then pp_sep fmt ();
|
if not first then pp_sep fmt ();
|
||||||
pp_x fmt x;
|
pp_x fmt x;
|
||||||
pp_mult ~first:false x (n-1)
|
pp_mult ~first:false x (n - 1)
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
pp_start fmt ();
|
pp_start fmt ();
|
||||||
let first = ref true in
|
let first = ref true in
|
||||||
iter m
|
iter m (fun x n ->
|
||||||
(fun x n ->
|
|
||||||
if !first then
|
if !first then
|
||||||
first := false
|
first := false
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue