mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
more documentation in CCGen
This commit is contained in:
parent
9b3419055e
commit
21fba9effa
1 changed files with 10 additions and 8 deletions
|
|
@ -28,7 +28,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
Values of type ['a Gen.t] represent a possibly infinite sequence of values
|
Values of type ['a Gen.t] represent a possibly infinite sequence of values
|
||||||
of type 'a. One can only iterate once on the sequence, as it is consumed
|
of type 'a. One can only iterate once on the sequence, as it is consumed
|
||||||
by iteration/deconstruction/access. [None] is returned when the generator
|
by iteration/deconstruction/access. [None] is returned when the generator
|
||||||
is exhausted.
|
is exhausted. Most functions consume elements.
|
||||||
|
|
||||||
The submodule {!Restart} provides utilities to work with
|
The submodule {!Restart} provides utilities to work with
|
||||||
{b restartable generators}, that is, functions [unit -> 'a Gen.t] that
|
{b restartable generators}, that is, functions [unit -> 'a Gen.t] that
|
||||||
|
|
@ -78,25 +78,27 @@ module type S = sig
|
||||||
(** {2 Basic combinators} *)
|
(** {2 Basic combinators} *)
|
||||||
|
|
||||||
val is_empty : _ t -> bool
|
val is_empty : _ t -> bool
|
||||||
(** Check whether the enum is empty. *)
|
(** Check whether the genertor is empty. Consumes one element if the
|
||||||
|
generator isn't empty. *)
|
||||||
|
|
||||||
val fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
|
val fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
|
||||||
(** Fold on the generator, tail-recursively *)
|
(** Fold on the generator, tail-recursively; consumes it *)
|
||||||
|
|
||||||
val reduce : ('a -> 'a -> 'a) -> 'a t -> 'a
|
val reduce : ('a -> 'a -> 'a) -> 'a t -> 'a
|
||||||
(** Fold on non-empty sequences (otherwise raise Invalid_argument) *)
|
(** Fold on non-empty sequences
|
||||||
|
@raise Invalid_argument if the generator is empty *)
|
||||||
|
|
||||||
val scan : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b t
|
val scan : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b t
|
||||||
(** Like {!fold}, but keeping successive values of the accumulator *)
|
(** Like {!fold}, but keeping successive values of the accumulator *)
|
||||||
|
|
||||||
val iter : ('a -> unit) -> 'a t -> unit
|
val iter : ('a -> unit) -> 'a t -> unit
|
||||||
(** Iterate on the enum *)
|
(** Iterate on the generator, consuming it *)
|
||||||
|
|
||||||
val iteri : (int -> 'a -> unit) -> 'a t -> unit
|
val iteri : (int -> 'a -> unit) -> 'a t -> unit
|
||||||
(** Iterate on elements with their index in the enum, from 0 *)
|
(** Iterate on elements with their index in the enum, from 0. Consumes it. *)
|
||||||
|
|
||||||
val length : _ t -> int
|
val length : _ t -> int
|
||||||
(** Length of an enum (linear time) *)
|
(** Length of a generator (linear time, consumes its input) *)
|
||||||
|
|
||||||
val map : ('a -> 'b) -> 'a t -> 'b t
|
val map : ('a -> 'b) -> 'a t -> 'b t
|
||||||
(** Lazy map. No iteration is performed now, the function will be called
|
(** Lazy map. No iteration is performed now, the function will be called
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue