From db87ae4a9cba040f607d4af4af6c62d39a62cd9b Mon Sep 17 00:00:00 2001 From: c-cube Date: Fri, 16 Jun 2023 02:06:45 +0000 Subject: [PATCH] deploy: adda7864e18b6ac1d348c26d4e62598fc7efaaf9 --- dev/containers/CCList/index.html | 2 +- dev/containers/CCListLabels/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/containers/CCList/index.html b/dev/containers/CCList/index.html index 52ee3172..9e07e3d2 100644 --- a/dev/containers/CCList/index.html +++ b/dev/containers/CCList/index.html @@ -75,7 +75,7 @@ return @@ x * x;; val square_even : int list -> int list = <fun> # square_even [1;2;4;3;5;2];; -- : int list = [4; 16; 4]
val return : 'a -> 'a t

return x is x.

val take : int -> 'a t -> 'a t

take n l takes the n first elements of the list l, drop the rest.

val drop : int -> 'a t -> 'a t

drop n l drops the n first elements of the list l, keep the rest.

val hd_tl : 'a t -> 'a * 'a t

hd_tl (x :: l) returns hd, l.

  • raises Failure

    if the list is empty.

  • since 0.16
val take_drop : int -> 'a t -> 'a t * 'a t

take_drop n l returns l1, l2 such that l1 @ l2 = l and length l1 = min (length l) n.

val take_while : ('a -> bool) -> 'a t -> 'a t

take_while f l returns the longest prefix of l for which f is true.

  • since 0.13
val drop_while : ('a -> bool) -> 'a t -> 'a t

drop_while f l drops the longest prefix of l for which f is true.

  • since 0.13
val take_drop_while : ('a -> bool) -> 'a t -> 'a t * 'a t

take_drop_while p l = take_while p l, drop_while p l.

  • since 1.2, but only
  • since 2.2 with labels
val last : int -> 'a t -> 'a t

last n l takes the last n elements of l (or less if l doesn't have that many elements).

val head_opt : 'a t -> 'a option

head_opt l returns Some x (the first element of the list l) or None if the list l is empty.

  • since 0.20
val tail_opt : 'a t -> 'a t option

tail_opt l returns Some l' (the given list l without its first element) or None if the list l is empty.

  • since 2.0
val last_opt : 'a t -> 'a option

last_opt l returns Some x (the last element of l) or None if the list l is empty.

  • since 0.20
val find_pred : ('a -> bool) -> 'a t -> 'a option

find_pred p l finds the first element of l that satisfies p, or returns None if no element satisfies p.

  • since 0.11
val find_opt : ('a -> bool) -> 'a t -> 'a option

find_opt p l is the safe version of find.

  • since 1.5, but only
  • since 2.2 with labels
val find_pred_exn : ('a -> bool) -> 'a t -> 'a

find_pred_exn p l is the unsafe version of find_pred.

  • raises Not_found

    if no such element is found.

  • since 0.11
val find_map : ('a -> 'b option) -> 'a t -> 'b option

find_map f l traverses l, applying f to each element. If for some element x, f x = Some y, then Some y is returned. Otherwise the call returns None.

  • since 0.11
val find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b option

find_mapi f l is like find_map, but also pass the index to the predicate function.

  • since 0.11
val find_idx : ('a -> bool) -> 'a t -> (int * 'a) option

find_idx p x returns Some (i,x) where x is the i-th element of l, and p x holds. Otherwise returns None.

val remove : eq:('a -> 'a -> bool) -> key:'a -> 'a t -> 'a t

remove ~eq ~key l removes every instance of key from l. Tail-recursive.

  • parameter eq

    equality function.

  • since 0.11
val filter_map : ('a -> 'b option) -> 'a t -> 'b t

filter_map f l is the sublist of l containing only elements for which f returns Some e. Map and remove elements at the same time.

val keep_some : 'a option t -> 'a t

keep_some l retains only elements of the form Some x. Like filter_map CCFun.id.

  • since 1.3, but only
  • since 2.2 with labels
val keep_ok : ('a, _) result t -> 'a t

keep_ok l retains only elements of the form Ok x.

  • since 1.3, but only
  • since 2.2 with labels
val all_some : 'a option t -> 'a t option

all_some l returns Some l' if all elements of l are of the form Some x, or None otherwise.

  • since 1.3, but only
  • since 2.2 with labels
val all_ok : ('a, 'err) result t -> ('a t, 'err) result

all_ok l returns Ok l' if all elements of l are of the form Ok x, or Error e otherwise (with the first error met).

  • since 1.3, but only
  • since 2.2 with labels
val sorted_mem : cmp:('a -> 'a -> int) -> '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.

  • since 3.5
val sorted_merge : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_merge ~cmp l1 l2 merges elements from both sorted list using the given comparison function cmp.

val sorted_diff : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_diff ~cmp l1 l2 returns the elements in l1 that are not in l2. Both lists are assumed to be sorted with respect to cmp and duplicate elements in the input lists are treated individually; for example, sorted_diff ~cmp [1;1;1;2;2;3] [1;2;2] would be [1;1;3]. It is the left inverse of sorted_merge; that is, sorted_diff ~cmp (sorted_merge ~cmp l1 l2) l2 is always equal to l1 for sorted lists l1 and l2.

  • since 3.5
val sort_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list

sort_uniq ~cmp l sorts the list l using the given comparison function cmp and remove duplicate elements.

val sorted_merge_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_merge_uniq ~cmp l1 l2 merges the sorted lists l1 and l2 and removes duplicates.

  • since 0.10
val sorted_diff_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_diff_uniq ~cmp l1 l2 collects the elements in l1 that are not in l2 and then remove duplicates. Both lists are assumed to be sorted with respect to cmp and duplicate elements in the input lists are treated individually; for example, sorted_diff_uniq ~cmp [1;1;1;2;2] [1;2;2;2] would be [1]. sorted_diff_uniq ~cmp l1 l2 and uniq_succ ~eq (sorted_diff ~cmp l1 l2) always give the same result for sorted l1 and l2 and compatible cmp and eq.

  • since 3.5
val is_sorted : cmp:('a -> 'a -> int) -> 'a list -> bool

is_sorted ~cmp l returns true iff l is sorted (according to given order).

  • parameter cmp

    the comparison function.

  • since 0.17
val sorted_insert : +- : int list = [4; 16; 4]
  • since 3.1
val return : 'a -> 'a t

return x is x.

val take : int -> 'a t -> 'a t

take n l takes the n first elements of the list l, drop the rest.

val drop : int -> 'a t -> 'a t

drop n l drops the n first elements of the list l, keep the rest.

val hd_tl : 'a t -> 'a * 'a t

hd_tl (x :: l) returns x, l.

  • raises Failure

    if the list is empty.

  • since 0.16
val take_drop : int -> 'a t -> 'a t * 'a t

take_drop n l returns l1, l2 such that l1 @ l2 = l and length l1 = min (length l) n.

val take_while : ('a -> bool) -> 'a t -> 'a t

take_while f l returns the longest prefix of l for which f is true.

  • since 0.13
val drop_while : ('a -> bool) -> 'a t -> 'a t

drop_while f l drops the longest prefix of l for which f is true.

  • since 0.13
val take_drop_while : ('a -> bool) -> 'a t -> 'a t * 'a t

take_drop_while p l = take_while p l, drop_while p l.

  • since 1.2, but only
  • since 2.2 with labels
val last : int -> 'a t -> 'a t

last n l takes the last n elements of l (or less if l doesn't have that many elements).

val head_opt : 'a t -> 'a option

head_opt l returns Some x (the first element of the list l) or None if the list l is empty.

  • since 0.20
val tail_opt : 'a t -> 'a t option

tail_opt l returns Some l' (the given list l without its first element) or None if the list l is empty.

  • since 2.0
val last_opt : 'a t -> 'a option

last_opt l returns Some x (the last element of l) or None if the list l is empty.

  • since 0.20
val find_pred : ('a -> bool) -> 'a t -> 'a option

find_pred p l finds the first element of l that satisfies p, or returns None if no element satisfies p.

  • since 0.11
val find_opt : ('a -> bool) -> 'a t -> 'a option

find_opt p l is the safe version of find.

  • since 1.5, but only
  • since 2.2 with labels
val find_pred_exn : ('a -> bool) -> 'a t -> 'a

find_pred_exn p l is the unsafe version of find_pred.

  • raises Not_found

    if no such element is found.

  • since 0.11
val find_map : ('a -> 'b option) -> 'a t -> 'b option

find_map f l traverses l, applying f to each element. If for some element x, f x = Some y, then Some y is returned. Otherwise the call returns None.

  • since 0.11
val find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b option

find_mapi f l is like find_map, but also pass the index to the predicate function.

  • since 0.11
val find_idx : ('a -> bool) -> 'a t -> (int * 'a) option

find_idx p x returns Some (i,x) where x is the i-th element of l, and p x holds. Otherwise returns None.

val remove : eq:('a -> 'a -> bool) -> key:'a -> 'a t -> 'a t

remove ~eq ~key l removes every instance of key from l. Tail-recursive.

  • parameter eq

    equality function.

  • since 0.11
val filter_map : ('a -> 'b option) -> 'a t -> 'b t

filter_map f l is the sublist of l containing only elements for which f returns Some e. Map and remove elements at the same time.

val keep_some : 'a option t -> 'a t

keep_some l retains only elements of the form Some x. Like filter_map CCFun.id.

  • since 1.3, but only
  • since 2.2 with labels
val keep_ok : ('a, _) result t -> 'a t

keep_ok l retains only elements of the form Ok x.

  • since 1.3, but only
  • since 2.2 with labels
val all_some : 'a option t -> 'a t option

all_some l returns Some l' if all elements of l are of the form Some x, or None otherwise.

  • since 1.3, but only
  • since 2.2 with labels
val all_ok : ('a, 'err) result t -> ('a t, 'err) result

all_ok l returns Ok l' if all elements of l are of the form Ok x, or Error e otherwise (with the first error met).

  • since 1.3, but only
  • since 2.2 with labels
val sorted_mem : cmp:('a -> 'a -> int) -> '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.

  • since 3.5
val sorted_merge : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_merge ~cmp l1 l2 merges elements from both sorted list using the given comparison function cmp.

val sorted_diff : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_diff ~cmp l1 l2 returns the elements in l1 that are not in l2. Both lists are assumed to be sorted with respect to cmp and duplicate elements in the input lists are treated individually; for example, sorted_diff ~cmp [1;1;1;2;2;3] [1;2;2] would be [1;1;3]. It is the left inverse of sorted_merge; that is, sorted_diff ~cmp (sorted_merge ~cmp l1 l2) l2 is always equal to l1 for sorted lists l1 and l2.

  • since 3.5
val sort_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list

sort_uniq ~cmp l sorts the list l using the given comparison function cmp and remove duplicate elements.

val sorted_merge_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_merge_uniq ~cmp l1 l2 merges the sorted lists l1 and l2 and removes duplicates.

  • since 0.10
val sorted_diff_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_diff_uniq ~cmp l1 l2 collects the elements in l1 that are not in l2 and then remove duplicates. Both lists are assumed to be sorted with respect to cmp and duplicate elements in the input lists are treated individually; for example, sorted_diff_uniq ~cmp [1;1;1;2;2] [1;2;2;2] would be [1]. sorted_diff_uniq ~cmp l1 l2 and uniq_succ ~eq (sorted_diff ~cmp l1 l2) always give the same result for sorted l1 and l2 and compatible cmp and eq.

  • since 3.5
val is_sorted : cmp:('a -> 'a -> int) -> 'a list -> bool

is_sorted ~cmp l returns true iff l is sorted (according to given order).

  • parameter cmp

    the comparison function.

  • since 0.17
val sorted_insert : cmp:('a -> 'a -> int) -> ?uniq:bool -> 'a -> diff --git a/dev/containers/CCListLabels/index.html b/dev/containers/CCListLabels/index.html index 4bc33309..da5ae8d9 100644 --- a/dev/containers/CCListLabels/index.html +++ b/dev/containers/CCListLabels/index.html @@ -97,7 +97,7 @@ return @@ x * x;; val square_even : int list -> int list = <fun> # square_even [1;2;4;3;5;2];; -- : int list = [4; 16; 4]
  • since 3.1
val return : 'a -> 'a t

return x is x.

val take : int -> 'a t -> 'a t

take n l takes the n first elements of the list l, drop the rest.

val drop : int -> 'a t -> 'a t

drop n l drops the n first elements of the list l, keep the rest.

val hd_tl : 'a t -> 'a * 'a t

hd_tl (x :: l) returns hd, l.

  • raises Failure

    if the list is empty.

  • since 0.16
val take_drop : int -> 'a t -> 'a t * 'a t

take_drop n l returns l1, l2 such that l1 @ l2 = l and length l1 = min (length l) n.

val take_while : f:('a -> bool) -> 'a t -> 'a t

take_while ~f l returns the longest prefix of l for which f is true.

  • since 0.13
val drop_while : f:('a -> bool) -> 'a t -> 'a t

drop_while ~f l drops the longest prefix of l for which f is true.

  • since 0.13
val take_drop_while : f:('a -> bool) -> 'a t -> 'a t * 'a t

take_drop_while ~f l = take_while ~f l, drop_while ~f l.

  • since 1.2, but only
  • since 2.2 with labels
val last : int -> 'a t -> 'a t

last n l takes the last n elements of l (or less if l doesn't have that many elements).

val head_opt : 'a t -> 'a option

head_opt l returns Some x (the first element of the list l) or None if the list l is empty.

  • since 0.20
val tail_opt : 'a t -> 'a t option

tail_opt l returns Some l' (the given list l without its first element) or None if the list l is empty.

  • since 2.0
val last_opt : 'a t -> 'a option

last_opt l returns Some x (the last element of l) or None if the list l is empty.

  • since 0.20
val find_pred : f:('a -> bool) -> 'a t -> 'a option

find_pred ~f l finds the first element of l that satisfies f, or returns None if no element satisfies f.

  • since 0.11
val find_opt : f:('a -> bool) -> 'a t -> 'a option

find_opt ~f l is the safe version of find.

  • since 1.5, but only
  • since 2.2 with labels
val find_pred_exn : f:('a -> bool) -> 'a t -> 'a

find_pred_exn ~f l is the unsafe version of find_pred.

  • raises Not_found

    if no such element is found.

  • since 0.11
val find_map : f:('a -> 'b option) -> 'a t -> 'b option

find_map ~f l traverses l, applying f to each element. If for some element x, f x = Some y, then Some y is returned. Otherwise the call returns None.

  • since 0.11
val find_mapi : f:(int -> 'a -> 'b option) -> 'a t -> 'b option

find_mapi ~f l is like find_map, but also pass the index to the predicate function.

  • since 0.11
val find_idx : f:('a -> bool) -> 'a t -> (int * 'a) option

find_idx ~f x returns Some (i,x) where x is the i-th element of l, and f x holds. Otherwise returns None.

val remove : eq:('a -> 'a -> bool) -> key:'a -> 'a t -> 'a t

remove ~eq ~key l removes every instance of key from l. Tail-recursive.

  • parameter eq

    equality function.

  • since 0.11
val filter_map : f:('a -> 'b option) -> 'a t -> 'b t

filter_map ~f l is the sublist of l containing only elements for which f returns Some e. Map and remove elements at the same time.

val keep_some : 'a option t -> 'a t

keep_some l retains only elements of the form Some x. Like filter_map CCFun.id.

  • since 1.3, but only
  • since 2.2 with labels
val keep_ok : ('a, _) result t -> 'a t

keep_ok l retains only elements of the form Ok x.

  • since 1.3, but only
  • since 2.2 with labels
val all_some : 'a option t -> 'a t option

all_some l returns Some l' if all elements of l are of the form Some x, or None otherwise.

  • since 1.3, but only
  • since 2.2 with labels
val all_ok : ('a, 'err) result t -> ('a t, 'err) result

all_ok l returns Ok l' if all elements of l are of the form Ok x, or Error e otherwise (with the first error met).

  • since 1.3, but only
  • since 2.2 with labels
val sorted_mem : cmp:('a -> 'a -> int) -> '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.

  • since 3.5
val sorted_merge : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_merge ~cmp l1 l2 merges elements from both sorted list using the given comparison function cmp.

val sorted_diff : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_diff ~cmp l1 l2 returns the elements in l1 that are not in l2. Both lists are assumed to be sorted with respect to cmp and duplicate elements in the input lists are treated individually; for example, sorted_diff ~cmp [1;1;1;2;2;3] [1;2;2] would be [1;1;3]. It is the left inverse of sorted_merge; that is, sorted_diff ~cmp (sorted_merge ~cmp l1 l2) l2 is always equal to l1 for sorted lists l1 and l2.

  • since 3.5
val sort_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list

sort_uniq ~cmp l sorts the list l using the given comparison function cmp and remove duplicate elements.

val sorted_merge_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_merge_uniq ~cmp l1 l2 merges the sorted lists l1 and l2 and removes duplicates.

  • since 0.10
val sorted_diff_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_diff_uniq ~cmp l1 l2 collects the elements in l1 that are not in l2 and then remove duplicates. Both lists are assumed to be sorted with respect to cmp and duplicate elements in the input lists are treated individually; for example, sorted_diff_uniq ~cmp [1;1;1;2;2] [1;2;2;2] would be [1]. sorted_diff_uniq ~cmp l1 l2 and uniq_succ ~eq (sorted_diff ~cmp l1 l2) always give the same result for sorted l1 and l2 and compatible cmp and eq.

  • since 3.5
val is_sorted : cmp:('a -> 'a -> int) -> 'a list -> bool

is_sorted ~cmp l returns true iff l is sorted (according to given order).

  • parameter cmp

    the comparison function.

  • since 0.17
val sorted_insert : +- : int list = [4; 16; 4]
  • since 3.1
val return : 'a -> 'a t

return x is x.

val take : int -> 'a t -> 'a t

take n l takes the n first elements of the list l, drop the rest.

val drop : int -> 'a t -> 'a t

drop n l drops the n first elements of the list l, keep the rest.

val hd_tl : 'a t -> 'a * 'a t

hd_tl (x :: l) returns x, l.

  • raises Failure

    if the list is empty.

  • since 0.16
val take_drop : int -> 'a t -> 'a t * 'a t

take_drop n l returns l1, l2 such that l1 @ l2 = l and length l1 = min (length l) n.

val take_while : f:('a -> bool) -> 'a t -> 'a t

take_while ~f l returns the longest prefix of l for which f is true.

  • since 0.13
val drop_while : f:('a -> bool) -> 'a t -> 'a t

drop_while ~f l drops the longest prefix of l for which f is true.

  • since 0.13
val take_drop_while : f:('a -> bool) -> 'a t -> 'a t * 'a t

take_drop_while ~f l = take_while ~f l, drop_while ~f l.

  • since 1.2, but only
  • since 2.2 with labels
val last : int -> 'a t -> 'a t

last n l takes the last n elements of l (or less if l doesn't have that many elements).

val head_opt : 'a t -> 'a option

head_opt l returns Some x (the first element of the list l) or None if the list l is empty.

  • since 0.20
val tail_opt : 'a t -> 'a t option

tail_opt l returns Some l' (the given list l without its first element) or None if the list l is empty.

  • since 2.0
val last_opt : 'a t -> 'a option

last_opt l returns Some x (the last element of l) or None if the list l is empty.

  • since 0.20
val find_pred : f:('a -> bool) -> 'a t -> 'a option

find_pred ~f l finds the first element of l that satisfies f, or returns None if no element satisfies f.

  • since 0.11
val find_opt : f:('a -> bool) -> 'a t -> 'a option

find_opt ~f l is the safe version of find.

  • since 1.5, but only
  • since 2.2 with labels
val find_pred_exn : f:('a -> bool) -> 'a t -> 'a

find_pred_exn ~f l is the unsafe version of find_pred.

  • raises Not_found

    if no such element is found.

  • since 0.11
val find_map : f:('a -> 'b option) -> 'a t -> 'b option

find_map ~f l traverses l, applying f to each element. If for some element x, f x = Some y, then Some y is returned. Otherwise the call returns None.

  • since 0.11
val find_mapi : f:(int -> 'a -> 'b option) -> 'a t -> 'b option

find_mapi ~f l is like find_map, but also pass the index to the predicate function.

  • since 0.11
val find_idx : f:('a -> bool) -> 'a t -> (int * 'a) option

find_idx ~f x returns Some (i,x) where x is the i-th element of l, and f x holds. Otherwise returns None.

val remove : eq:('a -> 'a -> bool) -> key:'a -> 'a t -> 'a t

remove ~eq ~key l removes every instance of key from l. Tail-recursive.

  • parameter eq

    equality function.

  • since 0.11
val filter_map : f:('a -> 'b option) -> 'a t -> 'b t

filter_map ~f l is the sublist of l containing only elements for which f returns Some e. Map and remove elements at the same time.

val keep_some : 'a option t -> 'a t

keep_some l retains only elements of the form Some x. Like filter_map CCFun.id.

  • since 1.3, but only
  • since 2.2 with labels
val keep_ok : ('a, _) result t -> 'a t

keep_ok l retains only elements of the form Ok x.

  • since 1.3, but only
  • since 2.2 with labels
val all_some : 'a option t -> 'a t option

all_some l returns Some l' if all elements of l are of the form Some x, or None otherwise.

  • since 1.3, but only
  • since 2.2 with labels
val all_ok : ('a, 'err) result t -> ('a t, 'err) result

all_ok l returns Ok l' if all elements of l are of the form Ok x, or Error e otherwise (with the first error met).

  • since 1.3, but only
  • since 2.2 with labels
val sorted_mem : cmp:('a -> 'a -> int) -> '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.

  • since 3.5
val sorted_merge : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_merge ~cmp l1 l2 merges elements from both sorted list using the given comparison function cmp.

val sorted_diff : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_diff ~cmp l1 l2 returns the elements in l1 that are not in l2. Both lists are assumed to be sorted with respect to cmp and duplicate elements in the input lists are treated individually; for example, sorted_diff ~cmp [1;1;1;2;2;3] [1;2;2] would be [1;1;3]. It is the left inverse of sorted_merge; that is, sorted_diff ~cmp (sorted_merge ~cmp l1 l2) l2 is always equal to l1 for sorted lists l1 and l2.

  • since 3.5
val sort_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list

sort_uniq ~cmp l sorts the list l using the given comparison function cmp and remove duplicate elements.

val sorted_merge_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_merge_uniq ~cmp l1 l2 merges the sorted lists l1 and l2 and removes duplicates.

  • since 0.10
val sorted_diff_uniq : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

sorted_diff_uniq ~cmp l1 l2 collects the elements in l1 that are not in l2 and then remove duplicates. Both lists are assumed to be sorted with respect to cmp and duplicate elements in the input lists are treated individually; for example, sorted_diff_uniq ~cmp [1;1;1;2;2] [1;2;2;2] would be [1]. sorted_diff_uniq ~cmp l1 l2 and uniq_succ ~eq (sorted_diff ~cmp l1 l2) always give the same result for sorted l1 and l2 and compatible cmp and eq.

  • since 3.5
val is_sorted : cmp:('a -> 'a -> int) -> 'a list -> bool

is_sorted ~cmp l returns true iff l is sorted (according to given order).

  • parameter cmp

    the comparison function.

  • since 0.17
val sorted_insert : cmp:('a -> 'a -> int) -> ?uniq:bool -> 'a ->