mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-05 19:00:31 -05:00
fix @since in CCSeq
This commit is contained in:
parent
4e79b72306
commit
e25b9fc9b4
2 changed files with 32 additions and 61 deletions
|
|
@ -132,6 +132,7 @@ api:
|
||||||
- remove slice APIs in string and array.
|
- remove slice APIs in string and array.
|
||||||
- change pp functions to take unit printer for sep/stop/start (#295)
|
- change pp functions to take unit printer for sep/stop/start (#295)
|
||||||
- CCPair: use more standard name for some map functions (#316)
|
- CCPair: use more standard name for some map functions (#316)
|
||||||
|
- add CCSeq module, mostly adapted from `CCKlist`
|
||||||
- remove `CCKlist` from everywhere
|
- remove `CCKlist` from everywhere
|
||||||
- CCGraph: remove deprecated module and function
|
- CCGraph: remove deprecated module and function
|
||||||
- rename `<op>_std_seq` to `<op>_seq`, making `Seq.t` the standard everywhere;
|
- rename `<op>_std_seq` to `<op>_seq`, making `Seq.t` the standard everywhere;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
(* This file is free software, part of containers. See file "license" for more details. *)
|
|
||||||
|
|
||||||
(** Helpers for the standard {b Seq} type
|
(** Helpers for the standard {b Seq} type
|
||||||
|
|
||||||
See {{: https://github.com/c-cube/oseq/} oseq} for a richer API.
|
See {{: https://github.com/c-cube/oseq/} oseq} for a richer API.
|
||||||
|
|
||||||
|
@since 3.0
|
||||||
*)
|
*)
|
||||||
|
|
||||||
type 'a iter = ('a -> unit) -> unit
|
type 'a iter = ('a -> unit) -> unit
|
||||||
|
|
@ -29,38 +29,31 @@ val singleton : 'a -> 'a t
|
||||||
|
|
||||||
val repeat : ?n:int -> 'a -> 'a t
|
val repeat : ?n:int -> 'a -> 'a t
|
||||||
(** [repeat ~n x] repeats [x] [n] times then stops. If [n] is omitted,
|
(** [repeat ~n x] repeats [x] [n] times then stops. If [n] is omitted,
|
||||||
then [x] is repeated forever.
|
then [x] is repeated forever. *)
|
||||||
@since 0.3.3 *)
|
|
||||||
|
|
||||||
val cycle : 'a t -> 'a t
|
val cycle : 'a t -> 'a t
|
||||||
(** Cycle through the iterator infinitely. The iterator shouldn't be empty.
|
(** Cycle through the iterator infinitely. The iterator shouldn't be empty. *)
|
||||||
@since 0.3.3 *)
|
|
||||||
|
|
||||||
val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t
|
val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t
|
||||||
(** [unfold f acc] calls [f acc] and:
|
(** [unfold f acc] calls [f acc] and:
|
||||||
- if [f acc = Some (x, acc')], yield [x], continue with [unfold f acc'].
|
- if [f acc = Some (x, acc')], yield [x], continue with [unfold f acc'].
|
||||||
- if [f acc = None], stops.
|
- if [f acc = None], stops. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
val is_empty : 'a t -> bool
|
val is_empty : 'a t -> bool
|
||||||
|
|
||||||
val head : 'a t -> 'a option
|
val head : 'a t -> 'a option
|
||||||
(** Head of the list.
|
(** Head of the list. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
val head_exn : 'a t -> 'a
|
val head_exn : 'a t -> 'a
|
||||||
(** Unsafe version of {!head}.
|
(** Unsafe version of {!head}.
|
||||||
@raise Not_found if the list is empty.
|
@raise Not_found if the list is empty. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
val tail : 'a t -> 'a t option
|
val tail : 'a t -> 'a t option
|
||||||
(** Tail of the list.
|
(** Tail of the list. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
val tail_exn : 'a t -> 'a t
|
val tail_exn : 'a t -> 'a t
|
||||||
(** Unsafe version of {!tail}.
|
(** Unsafe version of {!tail}.
|
||||||
@raise Not_found if the list is empty.
|
@raise Not_found if the list is empty. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
val equal : 'a equal -> 'a t equal
|
val equal : 'a equal -> 'a t equal
|
||||||
(** Equality step by step. Eager. *)
|
(** Equality step by step. Eager. *)
|
||||||
|
|
@ -77,8 +70,7 @@ val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
|
||||||
val iter : ('a -> unit) -> 'a t -> unit
|
val iter : ('a -> unit) -> 'a t -> unit
|
||||||
|
|
||||||
val iteri : (int -> 'a -> unit) -> 'a t -> unit
|
val iteri : (int -> 'a -> unit) -> 'a t -> unit
|
||||||
(** Iterate with index (starts at 0).
|
(** Iterate with index (starts at 0). *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
val length : _ t -> int
|
val length : _ t -> int
|
||||||
(** Number of elements in the list.
|
(** Number of elements in the list.
|
||||||
|
|
@ -96,8 +88,7 @@ val drop_while : ('a -> bool) -> 'a t -> 'a t
|
||||||
val map : ('a -> 'b) -> 'a t -> 'b t
|
val map : ('a -> 'b) -> 'a t -> 'b t
|
||||||
|
|
||||||
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
|
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
|
||||||
(** Map with index (starts at 0).
|
(** Map with index (starts at 0). *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
val fmap : ('a -> 'b option) -> 'a t -> 'b t
|
val fmap : ('a -> 'b option) -> 'a t -> 'b t
|
||||||
|
|
||||||
|
|
@ -107,24 +98,20 @@ val append : 'a t -> 'a t -> 'a t
|
||||||
|
|
||||||
val product_with : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
|
val product_with : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
|
||||||
(** Fair product of two (possibly infinite) lists into a new list. Lazy.
|
(** Fair product of two (possibly infinite) lists into a new list. Lazy.
|
||||||
The first parameter is used to combine each pair of elements.
|
The first parameter is used to combine each pair of elements. *)
|
||||||
@since 0.3.3 *)
|
|
||||||
|
|
||||||
val product : 'a t -> 'b t -> ('a * 'b) t
|
val product : 'a t -> 'b t -> ('a * 'b) t
|
||||||
(** Specialization of {!product_with} producing tuples.
|
(** Specialization of {!product_with} producing tuples. *)
|
||||||
@since 0.3.3 *)
|
|
||||||
|
|
||||||
val group : 'a equal -> 'a t -> 'a t t
|
val group : 'a equal -> 'a t -> 'a t t
|
||||||
(** [group eq l] groups together consecutive elements that satisfy [eq]. Lazy.
|
(** [group eq l] groups together consecutive elements that satisfy [eq]. Lazy.
|
||||||
For instance [group (=) [1;1;1;2;2;3;3;1]] yields
|
For instance [group (=) [1;1;1;2;2;3;3;1]] yields
|
||||||
[[1;1;1]; [2;2]; [3;3]; [1]].
|
[[1;1;1]; [2;2]; [3;3]; [1]]. *)
|
||||||
@since 0.3.3 *)
|
|
||||||
|
|
||||||
val uniq : 'a equal -> 'a t -> 'a t
|
val uniq : 'a equal -> 'a t -> 'a t
|
||||||
(** [uniq eq l] returns [l] but removes consecutive duplicates. Lazy.
|
(** [uniq eq l] returns [l] but removes consecutive duplicates. Lazy.
|
||||||
In other words, if several values that are equal follow one another,
|
In other words, if several values that are equal follow one another,
|
||||||
only the first of them is kept.
|
only the first of them is kept. *)
|
||||||
@since 0.3.3 *)
|
|
||||||
|
|
||||||
val for_all : ('a -> bool) -> 'a t -> bool
|
val for_all : ('a -> bool) -> 'a t -> bool
|
||||||
(** [for_all p [a1; ...; an]] checks if all elements of the sequence satisfy the
|
(** [for_all p [a1; ...; an]] checks if all elements of the sequence satisfy the
|
||||||
|
|
@ -153,8 +140,7 @@ val (--) : int -> int -> int t
|
||||||
[a] and [b] (therefore, never empty). *)
|
[a] and [b] (therefore, never empty). *)
|
||||||
|
|
||||||
val (--^) : int -> int -> int t
|
val (--^) : int -> int -> int t
|
||||||
(** [a -- b] is the integer range from [a] to [b], where [b] is excluded.
|
(** [a -- b] is the integer range from [a] to [b], where [b] is excluded. *)
|
||||||
@since 0.17 *)
|
|
||||||
|
|
||||||
(** {2 Operations on two Collections} *)
|
(** {2 Operations on two Collections} *)
|
||||||
|
|
||||||
|
|
@ -175,45 +161,36 @@ val merge : 'a ord -> 'a t -> 'a t -> 'a t
|
||||||
(** Merge two sorted iterators into a sorted iterator. *)
|
(** Merge two sorted iterators into a sorted iterator. *)
|
||||||
|
|
||||||
val zip : 'a t -> 'b t -> ('a * 'b) t
|
val zip : 'a t -> 'b t -> ('a * 'b) t
|
||||||
(** Combine elements pairwise. Stop as soon as one of the lists stops.
|
(** Combine elements pairwise. Stop as soon as one of the lists stops. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
val unzip : ('a * 'b) t -> 'a t * 'b t
|
val unzip : ('a * 'b) t -> 'a t * 'b t
|
||||||
(** Split each tuple in the list.
|
(** Split each tuple in the list. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
(** {2 Misc} *)
|
(** {2 Misc} *)
|
||||||
|
|
||||||
val sort : cmp:'a ord -> 'a t -> 'a t
|
val sort : cmp:'a ord -> 'a t -> 'a t
|
||||||
(** Eager sort. Require the iterator to be finite. [O(n ln(n))] time
|
(** Eager sort. Require the iterator to be finite. [O(n ln(n))] time
|
||||||
and space.
|
and space. *)
|
||||||
@since 0.3.3 *)
|
|
||||||
|
|
||||||
val sort_uniq : cmp:'a ord -> 'a t -> 'a t
|
val sort_uniq : cmp:'a ord -> 'a t -> 'a t
|
||||||
(** Eager sort that removes duplicate values. Require the iterator to be
|
(** Eager sort that removes duplicate values. Require the iterator to be
|
||||||
finite. [O(n ln(n))] time and space.
|
finite. [O(n ln(n))] time and space. *)
|
||||||
@since 0.3.3 *)
|
|
||||||
|
|
||||||
val memoize : 'a t -> 'a t
|
val memoize : 'a t -> 'a t
|
||||||
(** Avoid recomputations by caching intermediate results.
|
(** Avoid recomputations by caching intermediate results. *)
|
||||||
@since 0.14 *)
|
|
||||||
|
|
||||||
(** {2 Fair Combinations} *)
|
(** {2 Fair Combinations} *)
|
||||||
|
|
||||||
val interleave : 'a t -> 'a t -> 'a t
|
val interleave : 'a t -> 'a t -> 'a t
|
||||||
(** Fair interleaving of both streams.
|
(** Fair interleaving of both streams. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
val fair_flat_map : ('a -> 'b t) -> 'a t -> 'b t
|
val fair_flat_map : ('a -> 'b t) -> 'a t -> 'b t
|
||||||
(** Fair version of {!flat_map}.
|
(** Fair version of {!flat_map}. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
val fair_app : ('a -> 'b) t -> 'a t -> 'b t
|
val fair_app : ('a -> 'b) t -> 'a t -> 'b t
|
||||||
(** Fair version of {!(<*>)}.
|
(** Fair version of {!(<*>)}. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
(** {2 Implementations}
|
(** {2 Implementations} *)
|
||||||
@since 0.3.3 *)
|
|
||||||
|
|
||||||
val return : 'a -> 'a t
|
val return : 'a -> 'a t
|
||||||
val pure : 'a -> 'a t
|
val pure : 'a -> 'a t
|
||||||
|
|
@ -222,16 +199,12 @@ val (>|=) : 'a t -> ('a -> 'b) -> 'b t
|
||||||
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t
|
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t
|
||||||
|
|
||||||
val (>>-) : 'a t -> ('a -> 'b t) -> 'b t
|
val (>>-) : 'a t -> ('a -> 'b t) -> 'b t
|
||||||
(** Infix version of {! fair_flat_map}.
|
(** Infix version of {! fair_flat_map}. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
val (<.>) : ('a -> 'b) t -> 'a t -> 'b t
|
val (<.>) : ('a -> 'b) t -> 'a t -> 'b t
|
||||||
(** Infix version of {!fair_app}.
|
(** Infix version of {!fair_app}. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
(** {2 Infix operators}
|
(** {2 Infix operators} *)
|
||||||
|
|
||||||
@since 0.17 *)
|
|
||||||
|
|
||||||
module Infix : sig
|
module Infix : sig
|
||||||
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
|
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
|
||||||
|
|
@ -266,12 +239,10 @@ val to_list : 'a t -> 'a list
|
||||||
(** Gather all values into a list. *)
|
(** Gather all values into a list. *)
|
||||||
|
|
||||||
val of_array : 'a array -> 'a t
|
val of_array : 'a array -> 'a t
|
||||||
(** Iterate on the array.
|
(** Iterate on the array. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
val to_array : 'a t -> 'a array
|
val to_array : 'a t -> 'a array
|
||||||
(** Convert into array.
|
(** Convert into array. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
val to_rev_list : 'a t -> 'a list
|
val to_rev_list : 'a t -> 'a list
|
||||||
(** Convert to a list, in reverse order. More efficient than {!to_list}. *)
|
(** Convert to a list, in reverse order. More efficient than {!to_list}. *)
|
||||||
|
|
@ -281,8 +252,7 @@ val to_iter : 'a t -> 'a iter
|
||||||
val to_gen : 'a t -> 'a gen
|
val to_gen : 'a t -> 'a gen
|
||||||
|
|
||||||
val of_gen : 'a gen -> 'a t
|
val of_gen : 'a gen -> 'a t
|
||||||
(** [of_gen g] consumes the generator and caches intermediate results.
|
(** [of_gen g] consumes the generator and caches intermediate results. *)
|
||||||
@since 0.13 *)
|
|
||||||
|
|
||||||
(** {2 IO} *)
|
(** {2 IO} *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue