Take account of GPR#9668

master
John Whitington 2020-09-10 21:01:02 +01:00
parent 5a230ee8e7
commit 69c59b172d
2 changed files with 64 additions and 0 deletions

View File

@ -129,6 +129,38 @@ val flatten : 'a list list -> 'a list
*)
(** {1 Comparison} *)
val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool
(** [equal eq [a1; ...; an] [b1; ..; bm]] holds when
the two input lists have the same length, and for each
pair of elements [ai], [bi] at the same position we have
[eq ai bi].
Note: the [eq] function may be called even if the
lists have different length. If you know your equality
function is costly, you may want to check {!compare_lengths}
first.
@since 4.12.0
*)
val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int
(** [compare cmp [a1; ...; an] [b1; ...; bm]] performs
a lexicographic comparison of the two input lists,
using the same ['a -> 'a -> int] interface as {!Stdlib.compare}:
- [a1 :: l1] is smaller than [a2 :: l2] (negative result)
if [a1] is smaller than [a2], or if they are equal (0 result)
and [l1] is smaller than [l2]
- the empty list [[]] is strictly smaller than non-empty lists
Note: the [cmp] function will be called even if the lists have
different lengths.
@since 4.12.0
*)
(** {1 Iterators} *)

View File

@ -129,6 +129,38 @@ val flatten : 'a list list -> 'a list
*)
(** {1 Comparison} *)
val equal : eq:('a -> 'a -> bool) -> 'a list -> 'a list -> bool
(** [equal eq [a1; ...; an] [b1; ..; bm]] holds when
the two input lists have the same length, and for each
pair of elements [ai], [bi] at the same position we have
[eq ai bi].
Note: the [eq] function may be called even if the
lists have different length. If you know your equality
function is costly, you may want to check {!compare_lengths}
first.
@since 4.12.0
*)
val compare : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> int
(** [compare cmp [a1; ...; an] [b1; ...; bm]] performs
a lexicographic comparison of the two input lists,
using the same ['a -> 'a -> int] interface as {!Stdlib.compare}:
- [a1 :: l1] is smaller than [a2 :: l2] (negative result)
if [a1] is smaller than [a2], or if they are equal (0 result)
and [l1] is smaller than [l2]
- the empty list [[]] is strictly smaller than non-empty lists
Note: the [cmp] function will be called even if the lists have
different lengths.
@since 4.12.0
*)
(** {1 Iterators} *)