update sequenceLabels.mli

This commit is contained in:
Simon Cruanes 2017-12-15 12:40:43 +01:00
parent b3fdd356ca
commit b24ebfb405

View file

@ -118,14 +118,16 @@ val exists : f:('a -> bool) -> 'a t -> bool
val mem : ?eq:('a -> 'a -> bool) -> x:'a -> 'a t -> bool
(** Is the value a member of the sequence?
@param eq the equality predicate to use (default [(=)]) *)
@param eq the equality predicate to use (default [(=)])
@since 0.5 *)
val find : f:('a -> 'b option) -> 'a t -> 'b option
(** Find the first element on which the function doesn't return [None] *)
val find : ('a -> 'b option) -> 'a t -> 'b option
(** Find the first element on which the function doesn't return [None]
@since 0.5 *)
val find_map : f:('a -> 'b option) -> 'a t -> 'b option
(** Alias to {!find}
@since NEXT_RELEASE *)
@since 0.10 *)
val findi : f:(int -> 'a -> 'b option) -> 'a t -> 'b option
(** Indexed version of {!find}
@ -133,7 +135,7 @@ val findi : f:(int -> 'a -> 'b option) -> 'a t -> 'b option
val find_mapi : f:(int -> 'a -> 'b option) -> 'a t -> 'b option
(** Alias to {!findi}
@since NEXT_RELEASE *)
@since 0.10 *)
val find_pred : f:('a -> bool) -> 'a t -> 'a option
(** [find_pred p l] finds the first element of [l] that satisfies [p],
@ -160,6 +162,11 @@ val append : 'a t -> 'a t -> 'a t
(** Append two sequences. Iterating on the result is like iterating
on the first, then on the second. *)
val append_l : 'a t list -> 'a t
(** Append sequences. Iterating on the result is like iterating
on the each sequence of the list in order.
@since NEXT_RELEASE *)
val concat : 'a t t -> 'a t
(** Concatenate a sequence of sequences into one sequence. *)
@ -235,6 +242,7 @@ val group_by : ?hash:('a -> int) -> ?eq:('a -> 'a -> bool) ->
'a t -> 'a list t
(** Group equal elements, disregarding their order of appearance.
The result sequence is traversable as many times as required.
precondition: for any [x] and [y], if [eq x y] then [hash x=hash y] must hold.
@since 0.6 *)
val count : ?hash:('a -> int) -> ?eq:('a -> 'a -> bool) ->
@ -264,7 +272,8 @@ val diagonal : 'a t -> ('a * 'a) t
@since 0.9 *)
val product2 : 'a t -> 'b t -> ('a, 'b) t2
(** Binary version of {!product}. Same requirements. *)
(** Binary version of {!product}. Same requirements.
@since 0.5 *)
val join : join_row:('a -> 'b -> 'c option) -> 'a t -> 'b t -> 'c t
(** [join ~join_row a b] combines every element of [a] with every
@ -284,7 +293,8 @@ val join_by : ?eq:'key equal -> ?hash:'key hash ->
values [(x,y)] from [(a,b)] with the same [key]
using [merge]. If [merge] returns [None], the combination
of values is discarded.
@since NEXT_RELEASE *)
precondition: for any [x] and [y], if [eq x y] then [hash x=hash y] must hold.
@since 0.10 *)
val join_all_by : ?eq:'key equal -> ?hash:'key hash ->
('a -> 'key) -> ('b -> 'key) ->
@ -301,7 +311,7 @@ val join_all_by : ?eq:'key equal -> ?hash:'key hash ->
- call [merge k l1 l2]. If [merge] returns [None], the combination
of values is discarded, otherwise it returns [Some c]
and [c] is inserted in the result.
@since NEXT_RELEASE *)
@since 0.10 *)
val group_join_by : ?eq:'a equal -> ?hash:'a hash ->
('b -> 'a) ->
@ -313,14 +323,16 @@ val group_join_by : ?eq:'a equal -> ?hash:'a hash ->
sequence such that [eq x (key y)]. Elements of the first
sequences without corresponding values in the second one
are mapped to [[]]
@since NEXT_RELEASE *)
precondition: for any [x] and [y], if [eq x y] then [hash x=hash y] must hold.
@since 0.10 *)
val inter :
?eq:'a equal -> ?hash:'a hash ->
'a t -> 'a t -> 'a t
(** Intersection of two collections. Each element will occur at most once
in the result. Eager.
@since NEXT_RELEASE *)
precondition: for any [x] and [y], if [eq x y] then [hash x=hash y] must hold.
@since 0.10 *)
(*$=
[2;4;5;6] (inter (1--6) (cons 2 (4--10)) |> sort |> to_list)
@ -332,7 +344,8 @@ val union :
'a t -> 'a t -> 'a t
(** Union of two collections. Each element will occur at most once
in the result. Eager.
@since NEXT_RELEASE *)
precondition: for any [x] and [y], if [eq x y] then [hash x=hash y] must hold.
@since 0.10 *)
(*$=
[2;4;5;6] (union (4--6) (cons 2 (4--5)) |> sort |> to_list)
@ -342,7 +355,7 @@ val diff :
?eq:'a equal -> ?hash:'a hash ->
'a t -> 'a t -> 'a t
(** Set difference. Eager.
@since NEXT_RELEASE *)
@since 0.10 *)
(*$=
[1;2;8;9;10] (diff (1--10) (3--7) |> to_list)
@ -352,7 +365,8 @@ val subset :
?eq:'a equal -> ?hash:'a hash ->
'a t -> 'a t -> bool
(** [subset a b] returns [true] if all elements of [a] belong to [b]. Eager.
@since NEXT_RELEASE *)
precondition: for any [x] and [y], if [eq x y] then [hash x=hash y] must hold.
@since 0.10 *)
(*$T
subset (2 -- 4) (1 -- 4)
@ -375,7 +389,7 @@ val max : ?lt:('a -> 'a -> bool) -> 'a t -> 'a option
val max_exn : ?lt:('a -> 'a -> bool) -> 'a t -> 'a
(** Unsafe version of {!max}
@raise Not_found if the sequence is empty
@since NEXT_RELEASE *)
@since 0.10 *)
val min : ?lt:('a -> 'a -> bool) -> 'a t -> 'a option
(** Min element of the sequence, using the given comparison function.
@ -384,7 +398,7 @@ val min : ?lt:('a -> 'a -> bool) -> 'a t -> 'a option
val min_exn : ?lt:('a -> 'a -> bool) -> 'a t -> 'a
(** Unsafe version of {!min}
@raise Not_found if the sequence is empty
@since NEXT_RELEASE *)
@since 0.10 *)
val sum : int t -> int
(** Sum of elements
@ -395,11 +409,13 @@ val sumf : float t -> float
@since NEXT_RELEASE *)
val head : 'a t -> 'a option
(** First element, if any, otherwise [None] *)
(** First element, if any, otherwise [None]
@since 0.5.1 *)
val head_exn : 'a t -> 'a
(** First element, if any, fails
@raise Invalid_argument if the sequence is empty *)
@raise Invalid_argument if the sequence is empty
@since 0.5.1 *)
val take : int -> 'a t -> 'a t
(** Take at most [n] elements from the sequence. Works on infinite
@ -412,7 +428,8 @@ val take_while : f:('a -> bool) -> 'a t -> 'a t
val fold_while : f:('a -> 'b -> 'a * [`Stop | `Continue]) -> init:'a -> 'b t -> 'a
(** Folds over elements of the sequence, stopping early if the accumulator
returns [('a, `Stop)] *)
returns [('a, `Stop)]
@since 0.5.5 *)
val drop : int -> 'a t -> 'a t
(** Drop the [n] first elements of the sequence. Lazy. *)
@ -471,7 +488,8 @@ val pair_with_idx : 'a t -> (int * 'a) t
@since NEXT_RELEASE *)
val to_opt : 'a t -> 'a option
(** Alias to {!head} *)
(** Alias to {!head}
@since 0.5.1 *)
val to_array : 'a t -> 'a array
(** Convert to an array. Currently not very efficient because
@ -489,7 +507,8 @@ val array_slice : 'a array -> int -> int -> 'a t
from [i] to [j] *)
val of_opt : 'a option -> 'a t
(** Iterate on 0 or 1 values. *)
(** Iterate on 0 or 1 values.
@since 0.5.1 *)
val of_stream : 'a Stream.t -> 'a t
(** Sequence of elements of a stream (usable only once) *)
@ -537,7 +556,8 @@ val to_str : char t -> string
val concat_str : string t -> string
(** Concatenate strings together, eagerly.
Also see {!intersperse} to add a separator. *)
Also see {!intersperse} to add a separator.
@since 0.5 *)
exception OneShotSequence
(** Raised when the user tries to iterate several times on