@@ -16,10 +16,14 @@ type +'a t = 'a list
16
16
val empty : 'a t
17
17
(* * [empty] is [[]]. *)
18
18
19
+ [@@@ iflt 5.1 ]
20
+
19
21
val is_empty : _ t -> bool
20
22
(* * [is_empty l] returns [true] iff [l = []].
21
23
@since 0.11 *)
22
24
25
+ [@@@ endif]
26
+
23
27
val cons_maybe : 'a option -> 'a t -> 'a t
24
28
(* * [cons_maybe (Some x) l] is [x :: l].
25
29
[cons_maybe None l] is [l].
@@ -127,11 +131,6 @@ val count_true_false : ('a -> bool) -> 'a list -> int * int
127
131
that satisfy the predicate [p], and [int2] the number of elements that do not satisfy [p].
128
132
@since 2.4 *)
129
133
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
-
135
134
val combine : 'a list -> 'b list -> ('a * 'b ) list
136
135
(* * [combine [a1; …; an] [b1; …; bn]] is [[(a1,b1); …; (an,bn)]].
137
136
Transform two lists into a list of pairs.
@@ -161,25 +160,17 @@ val split : ('a * 'b) t -> 'a t * 'b t
161
160
@since 1.2, but only
162
161
@since 2.2 with labels *)
163
162
163
+ [@@@ iflt 4.12 ]
164
+
164
165
val compare : ('a -> 'a -> int ) -> 'a t -> 'a t -> int
165
166
(* * [compare cmp l1 l2] compares the two lists [l1] and [l2]
166
167
using the given comparison function [cmp]. *)
167
168
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
-
180
169
val equal : ('a -> 'a -> bool ) -> 'a t -> 'a t -> bool
181
170
(* * [equal p l1 l2] returns [true] if [l1] and [l2] are equal. *)
182
171
172
+ [@@@ endif]
173
+
183
174
val flat_map : ('a -> 'b t ) -> 'a t -> 'b t
184
175
(* * [flat_map f l] maps and flattens at the same time (safe). Evaluation order is not guaranteed. *)
185
176
@@ -437,26 +428,28 @@ val find_pred : ('a -> bool) -> 'a t -> 'a option
437
428
or returns [None] if no element satisfies [p].
438
429
@since 0.11 *)
439
430
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
-
445
431
val find_pred_exn : ('a -> bool ) -> 'a t -> 'a
446
432
(* * [find_pred_exn p l] is the unsafe version of {!find_pred}.
447
433
@raise Not_found if no such element is found.
448
434
@since 0.11 *)
449
435
436
+ [@@@ iflt 4.10 ]
437
+
450
438
val find_map : ('a -> 'b option ) -> 'a t -> 'b option
451
439
(* * [find_map f l] traverses [l], applying [f] to each element. If for
452
440
some element [x], [f x = Some y], then [Some y] is returned. Otherwise
453
441
the call returns [None].
454
442
@since 0.11 *)
455
443
444
+ [@@@ endif]
445
+ [@@@ iflt 5.1 ]
446
+
456
447
val find_mapi : (int -> 'a -> 'b option ) -> 'a t -> 'b option
457
448
(* * [find_mapi f l] is like {!find_map}, but also pass the index to the predicate function.
458
449
@since 0.11 *)
459
450
451
+ [@@@ endif]
452
+
460
453
val find_idx : ('a -> bool ) -> 'a t -> (int * 'a ) option
461
454
(* * [find_idx p x] returns [Some (i,x)] where [x] is the [i]-th element of [l],
462
455
and [p x] holds. Otherwise returns [None]. *)
@@ -467,11 +460,6 @@ val remove : eq:('a -> 'a -> bool) -> key:'a -> 'a t -> 'a t
467
460
@since 0.11 *)
468
461
(* FIXME: the original CCList.mli uses ~x instead of ~key !! *)
469
462
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
-
475
463
val keep_some : 'a option t -> 'a t
476
464
(* * [keep_some l] retains only elements of the form [Some x].
477
465
Like [filter_map CCFun.id].
@@ -574,16 +562,6 @@ val group_succ : eq:('a -> 'a -> bool) -> 'a list -> 'a list list
574
562
575
563
(* * {2 Indices} *)
576
564
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
-
587
565
val iteri2 : (int -> 'a -> 'b -> unit ) -> 'a t -> 'b t -> unit
588
566
(* * [iteri2 f l1 l2] applies [f] to the two lists [l1] and [l2] simultaneously.
589
567
The integer passed to [f] indicates the index of element.
@@ -758,14 +736,6 @@ val assoc_opt : eq:('a -> 'a -> bool) -> 'a -> ('a * 'b) t -> 'b option
758
736
@since 1.5, but only
759
737
@since 2.0 with labels *)
760
738
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
-
769
739
val mem_assoc : ?eq : ('a -> 'a -> bool ) -> 'a -> ('a * _ ) t -> bool
770
740
(* * [mem_assoc ?eq k alist] returns [true] iff [k] is a key in [alist].
771
741
Like [Assoc.mem].
@@ -884,11 +854,6 @@ val to_iter : 'a t -> 'a iter
884
854
(* * [to_iter l] returns a [iter] of the elements of the list [l].
885
855
@since 2.8 *)
886
856
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
-
892
857
val of_iter : 'a iter -> 'a t
893
858
(* * [of_iter iter] builds a list from a given [iter].
894
859
In the result, elements appear in the same order as they did in the source [iter].
@@ -899,12 +864,6 @@ val of_seq_rev : 'a Seq.t -> 'a t
899
864
Renamed from [to_std_seq_rev] since 3.0.
900
865
@since 3.0 *)
901
866
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
-
908
867
val to_gen : 'a t -> 'a gen
909
868
(* * [to_gen l] returns a [gen] of the elements of the list [l]. *)
910
869
0 commit comments