@@ -16,10 +16,14 @@ type +'a t = 'a list
1616val empty : 'a t
1717(* * [empty] is [[]]. *)
1818
19+ [@@@ iflt 5.1 ]
20+
1921val is_empty : _ t -> bool
2022(* * [is_empty l] returns [true] iff [l = []].
2123 @since 0.11 *)
2224
25+ [@@@ endif]
26+
2327val cons_maybe : 'a option -> 'a t -> 'a t
2428(* * [cons_maybe (Some x) l] is [x :: l].
2529 [cons_maybe None l] is [l].
@@ -127,11 +131,6 @@ val count_true_false : ('a -> bool) -> 'a list -> int * int
127131 that satisfy the predicate [p], and [int2] the number of elements that do not satisfy [p].
128132 @since 2.4 *)
129133
130- val init : int -> (int -> 'a ) -> 'a t
131- (* * [init len f] is [f 0; f 1; …; f (len-1)].
132- @raise Invalid_argument if len < 0.
133- @since 0.6 *)
134-
135134val combine : 'a list -> 'b list -> ('a * 'b ) list
136135(* * [combine [a1; …; an] [b1; …; bn]] is [[(a1,b1); …; (an,bn)]].
137136 Transform two lists into a list of pairs.
@@ -161,25 +160,17 @@ val split : ('a * 'b) t -> 'a t * 'b t
161160 @since 1.2, but only
162161 @since 2.2 with labels *)
163162
163+ [@@@ iflt 4.12 ]
164+
164165val compare : ('a -> 'a -> int ) -> 'a t -> 'a t -> int
165166(* * [compare cmp l1 l2] compares the two lists [l1] and [l2]
166167 using the given comparison function [cmp]. *)
167168
168- val compare_lengths : 'a t -> 'b t -> int
169- (* * [compare_lengths l1 l2] compare the lengths of the two lists [l1] and [l2].
170- Equivalent to [compare (length l1) (length l2)] but more efficient.
171- @since 1.5, but only
172- @since 2.2 with labels *)
173-
174- val compare_length_with : 'a t -> int -> int
175- (* * [compare_length_with l x] compares the length of the list [l] to an integer [x].
176- Equivalent to [compare (length l) x] but more efficient.
177- @since 1.5, but only
178- @since 2.2 with labels *)
179-
180169val equal : ('a -> 'a -> bool ) -> 'a t -> 'a t -> bool
181170(* * [equal p l1 l2] returns [true] if [l1] and [l2] are equal. *)
182171
172+ [@@@ endif]
173+
183174val flat_map : ('a -> 'b t ) -> 'a t -> 'b t
184175(* * [flat_map f l] maps and flattens at the same time (safe). Evaluation order is not guaranteed. *)
185176
@@ -437,26 +428,29 @@ val find_pred : ('a -> bool) -> 'a t -> 'a option
437428 or returns [None] if no element satisfies [p].
438429 @since 0.11 *)
439430
440- val find_opt : ('a -> bool ) -> 'a t -> 'a option
441- (* * [find_opt p l] is the safe version of {!find}.
442- @since 1.5, but only
443- @since 2.2 with labels *)
444-
445431val find_pred_exn : ('a -> bool ) -> 'a t -> 'a
446432(* * [find_pred_exn p l] is the unsafe version of {!find_pred}.
447433 @raise Not_found if no such element is found.
448434 @since 0.11 *)
449435
436+ [@@@ iflt 4.10 ]
437+
450438val find_map : ('a -> 'b option ) -> 'a t -> 'b option
451439(* * [find_map f l] traverses [l], applying [f] to each element. If for
452440 some element [x], [f x = Some y], then [Some y] is returned. Otherwise
453441 the call returns [None].
454442 @since 0.11 *)
455443
444+ [@@@ endif]
445+
446+ [@@@ iflt 5.1 ]
447+
456448val find_mapi : (int -> 'a -> 'b option ) -> 'a t -> 'b option
457449(* * [find_mapi f l] is like {!find_map}, but also pass the index to the predicate function.
458450 @since 0.11 *)
459451
452+ [@@@ endif]
453+
460454val find_idx : ('a -> bool ) -> 'a t -> (int * 'a ) option
461455(* * [find_idx p x] returns [Some (i,x)] where [x] is the [i]-th element of [l],
462456 and [p x] holds. Otherwise returns [None]. *)
@@ -467,11 +461,6 @@ val remove : eq:('a -> 'a -> bool) -> key:'a -> 'a t -> 'a t
467461 @since 0.11 *)
468462(* FIXME: the original CCList.mli uses ~x instead of ~key !! *)
469463
470- val filter_map : ('a -> 'b option ) -> 'a t -> 'b t
471- (* * [filter_map f l] is the sublist of [l] containing only elements for which
472- [f] returns [Some e].
473- Map and remove elements at the same time. *)
474-
475464val keep_some : 'a option t -> 'a t
476465(* * [keep_some l] retains only elements of the form [Some x].
477466 Like [filter_map CCFun.id].
@@ -574,16 +563,6 @@ val group_succ : eq:('a -> 'a -> bool) -> 'a list -> 'a list list
574563
575564(* * {2 Indices} *)
576565
577- val mapi : (int -> 'a -> 'b ) -> 'a t -> 'b t
578- (* * [mapi f l] is like {!map}, but the function [f] is applied to the index of
579- the element as first argument (counting from 0), and the element
580- itself as second argument. *)
581-
582- val iteri : (int -> 'a -> unit ) -> 'a t -> unit
583- (* * [iteri f l] is like {!val-iter}, but the function [f] is applied to the index of
584- the element as first argument (counting from 0), and the element
585- itself as second argument. *)
586-
587566val iteri2 : (int -> 'a -> 'b -> unit ) -> 'a t -> 'b t -> unit
588567(* * [iteri2 f l1 l2] applies [f] to the two lists [l1] and [l2] simultaneously.
589568 The integer passed to [f] indicates the index of element.
@@ -758,14 +737,6 @@ val assoc_opt : eq:('a -> 'a -> bool) -> 'a -> ('a * 'b) t -> 'b option
758737 @since 1.5, but only
759738 @since 2.0 with labels *)
760739
761- val assq_opt : 'a -> ('a * 'b ) t -> 'b option
762- (* * [assq_opt k alist] returns [Some v] if the given key [k] is present into [alist].
763- Like [Assoc.assoc_opt] but use physical equality instead of structural equality
764- to compare keys.
765- Safe version of {!assq}.
766- @since 1.5, but only
767- @since 2.0 with labels *)
768-
769740val mem_assoc : ?eq : ('a -> 'a -> bool ) -> 'a -> ('a * _ ) t -> bool
770741(* * [mem_assoc ?eq k alist] returns [true] iff [k] is a key in [alist].
771742 Like [Assoc.mem].
@@ -884,11 +855,6 @@ val to_iter : 'a t -> 'a iter
884855(* * [to_iter l] returns a [iter] of the elements of the list [l].
885856 @since 2.8 *)
886857
887- val to_seq : 'a t -> 'a Seq .t
888- (* * [to_seq l] returns a [Seq.t] of the elements of the list [l].
889- Renamed from [to_std_seq] since 3.0.
890- @since 3.0 *)
891-
892858val of_iter : 'a iter -> 'a t
893859(* * [of_iter iter] builds a list from a given [iter].
894860 In the result, elements appear in the same order as they did in the source [iter].
@@ -899,12 +865,6 @@ val of_seq_rev : 'a Seq.t -> 'a t
899865 Renamed from [to_std_seq_rev] since 3.0.
900866 @since 3.0 *)
901867
902- val of_seq : 'a Seq .t -> 'a t
903- (* * [of_seq seq] builds a list from a given [Seq.t].
904- In the result, elements appear in the same order as they did in the source [Seq.t].
905- Renamed from [of_std_seq] since 3.0.
906- @since 3.0 *)
907-
908868val to_gen : 'a t -> 'a gen
909869(* * [to_gen l] returns a [gen] of the elements of the list [l]. *)
910870
0 commit comments