diff --git a/dev/index.html b/dev/index.html index ca77c8b..ff29c01 100644 --- a/dev/index.html +++ b/dev/index.html @@ -11,7 +11,7 @@
diff --git a/dev/iter/Iter/IO/index.html b/dev/iter/Iter/IO/index.html index 4ed5bba..24ad335 100644 --- a/dev/iter/Iter/IO/index.html +++ b/dev/iter/Iter/IO/index.html @@ -1,5 +1,5 @@ -Iter.IOval lines_of : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> string tlines_of filename reads all lines of the given file. It raises the same exception as would opening the file and read from it, except from End_of_file (which is caught). The file is always properly closed. Every time the iterator is iterated on, the file is opened again, so different iterations might return different results
val chunks_of :
+IO (iter.Iter.IO) Module Iter.IO
val lines_of : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> string tlines_of filename reads all lines of the given file. It raises the same exception as would opening the file and read from it, except from End_of_file (which is caught). The file is always properly closed. Every time the iterator is iterated on, the file is opened again, so different iterations might return different results
val chunks_of :
?mode:int ->
?flags:Stdlib.open_flag list ->
?size:int ->
diff --git a/dev/iter/Iter/Infix/index.html b/dev/iter/Iter/Infix/index.html
index bdd1850..8c8373f 100644
--- a/dev/iter/Iter/Infix/index.html
+++ b/dev/iter/Iter/Infix/index.html
@@ -1,2 +1,2 @@
-Infix (iter.Iter.Infix) Module Iter.Infix
val (--) : int -> int -> int ta -- b is the range of integers from a to b, both included, in increasing order. It will therefore be empty if a > b.
val (--^) : int -> int -> int ta --^ b is the range of integers from b to a, both included, in decreasing order (starts from a). It will therefore be empty if a < b.
\ No newline at end of file
+Infix (iter.Iter.Infix) Module Iter.Infix
val (--) : int -> int -> int ta -- b is the range of integers from a to b, both included, in increasing order. It will therefore be empty if a > b.
val (--^) : int -> int -> int ta --^ b is the range of integers from b to a, both included, in decreasing order (starts from a). It will therefore be empty if a < b.
\ No newline at end of file
diff --git a/dev/iter/Iter/Map/Adapt/index.html b/dev/iter/Iter/Map/Adapt/index.html
index 88a6572..7bdb34e 100644
--- a/dev/iter/Iter/Map/Adapt/index.html
+++ b/dev/iter/Iter/Map/Adapt/index.html
@@ -1,5 +1,5 @@
-Adapt (iter.Iter.Map.Adapt) Module Map.Adapt
Adapt a pre-existing Map module to make it iterator-aware
Parameters
Signature
include Stdlib.Map.S with type key = M.key with type 'a t = 'a M.t
val empty : 'a tval is_empty : 'a t -> boolval merge :
+Adapt (iter.Iter.Map.Adapt) Module Map.Adapt
Adapt a pre-existing Map module to make it iterator-aware
Parameters
Signature
include Stdlib.Map.S with type key = M.key with type 'a t = 'a M.t
val empty : 'a tval is_empty : 'a t -> boolval merge :
( key -> 'a option -> 'b option -> 'c option ) ->
'a t ->
'b t ->
diff --git a/dev/iter/Iter/Map/Make/index.html b/dev/iter/Iter/Map/Make/index.html
index f620669..9e3f943 100644
--- a/dev/iter/Iter/Map/Make/index.html
+++ b/dev/iter/Iter/Map/Make/index.html
@@ -1,5 +1,5 @@
-Make (iter.Iter.Map.Make) Module Map.Make
Create an enriched Map module, with iterator-aware functions
Parameters
Signature
include Stdlib.Map.S with type key = V.t
val empty : 'a tval is_empty : 'a t -> boolval merge :
+Make (iter.Iter.Map.Make) Module Map.Make
Create an enriched Map module, with iterator-aware functions
Parameters
Signature
include Stdlib.Map.S with type key = V.t
val empty : 'a tval is_empty : 'a t -> boolval merge :
( key -> 'a option -> 'b option -> 'c option ) ->
'a t ->
'b t ->
diff --git a/dev/iter/Iter/Map/index.html b/dev/iter/Iter/Map/index.html
index a052f7d..260d21f 100644
--- a/dev/iter/Iter/Map/index.html
+++ b/dev/iter/Iter/Map/index.html
@@ -1,4 +1,4 @@
-Map (iter.Iter.Map) Module Iter.Map
module type S = sig ... endmodule Adapt
+Map (iter.Iter.Map) Module Iter.Map
module type S = sig ... endAdapt a pre-existing Map module to make it iterator-aware
\ No newline at end of file
diff --git a/dev/iter/Iter/Map/module-type-S/index.html b/dev/iter/Iter/Map/module-type-S/index.html
index 479e2b6..95fd1ae 100644
--- a/dev/iter/Iter/Map/module-type-S/index.html
+++ b/dev/iter/Iter/Map/module-type-S/index.html
@@ -1,5 +1,5 @@
-S (iter.Iter.Map.S) Module type Map.S
include Stdlib.Map.S
val empty : 'a tval is_empty : 'a t -> boolval merge :
+S (iter.Iter.Map.S) Module type Map.S
include Stdlib.Map.S
val empty : 'a tval is_empty : 'a t -> boolval merge :
( key -> 'a option -> 'b option -> 'c option ) ->
'a t ->
'b t ->
diff --git a/dev/iter/Iter/Set/Adapt/index.html b/dev/iter/Iter/Set/Adapt/index.html
index 6abf9d5..c96f8c5 100644
--- a/dev/iter/Iter/Set/Adapt/index.html
+++ b/dev/iter/Iter/Set/Adapt/index.html
@@ -1,2 +1,2 @@
-Adapt (iter.Iter.Set.Adapt) Module Set.Adapt
Create an enriched Set module from the given one
Parameters
Signature
\ No newline at end of file
+Adapt (iter.Iter.Set.Adapt) Module Set.Adapt
Create an enriched Set module from the given one
Parameters
Signature
\ No newline at end of file
diff --git a/dev/iter/Iter/Set/Make/index.html b/dev/iter/Iter/Set/Make/index.html
index 90cb662..79253e1 100644
--- a/dev/iter/Iter/Set/Make/index.html
+++ b/dev/iter/Iter/Set/Make/index.html
@@ -1,2 +1,2 @@
-Make (iter.Iter.Set.Make) Module Set.Make
Functor to build an extended Set module from an ordered type
Parameters
Signature
\ No newline at end of file
+Make (iter.Iter.Set.Make) Module Set.Make
Functor to build an extended Set module from an ordered type
Parameters
Signature
\ No newline at end of file
diff --git a/dev/iter/Iter/Set/index.html b/dev/iter/Iter/Set/index.html
index 8a0a751..4544ae9 100644
--- a/dev/iter/Iter/Set/index.html
+++ b/dev/iter/Iter/Set/index.html
@@ -1,2 +1,2 @@
-Set (iter.Iter.Set) Module Iter.Set
module type S = sig ... endCreate an enriched Set module from the given one
\ No newline at end of file
+Set (iter.Iter.Set) Module Iter.Set
module type S = sig ... endCreate an enriched Set module from the given one
\ No newline at end of file
diff --git a/dev/iter/Iter/Set/module-type-S/index.html b/dev/iter/Iter/Set/module-type-S/index.html
index 78ce688..269dad9 100644
--- a/dev/iter/Iter/Set/module-type-S/index.html
+++ b/dev/iter/Iter/Set/module-type-S/index.html
@@ -1,2 +1,2 @@
-S (iter.Iter.Set.S) Module type Set.S
\ No newline at end of file
+S (iter.Iter.Set.S) Module type Set.S
\ No newline at end of file
diff --git a/dev/iter/Iter/index.html b/dev/iter/Iter/index.html
index 658ed8c..8f9ef9b 100644
--- a/dev/iter/Iter/index.html
+++ b/dev/iter/Iter/index.html
@@ -1,5 +1,5 @@
-Iter (iter.Iter) Module Iter
Simple and Efficient Iterators
The iterators are designed to allow easy transfer (mappings) between data structures, without defining n^2 conversions between the n types. The implementation relies on the assumption that an iterator can be iterated on as many times as needed; this choice allows for high performance of many combinators. However, for transient iterators, the persistent function is provided, storing elements of a transient iterator in memory; the iterator can then be used several times (See further).
Note that some combinators also return iterators (e.g. group). The transformation is computed on the fly every time one iterates over the resulting iterator. If a transformation performs heavy computation, persistent can also be used as intermediate storage.
Most functions are lazy, i.e. they do not actually use their arguments until their result is iterated on. For instance, if one calls map on an iterator, one gets a new iterator, but nothing else happens until this new iterator is used (by folding or iterating on it).
If an iterator is built from an iteration function that is repeatable (i.e. calling it several times always iterates on the same set of elements, for instance List.iter or Map.iter), then the resulting t object is also repeatable. For one-time iter functions such as iteration on a file descriptor or a Seq, the persistent function can be used to iterate and store elements in a memory structure; the result is an iterator that iterates on the elements of this memory structure, cheaply and repeatably.
An iterator of values of type 'a. If you give it a function 'a -> unit it will be applied to every element of the iterator successively.
type +'a iter = 'a tNOTE Type ('a, 'b) t2 = ('a -> 'b -> unit) -> unit has been removed and subsumed by ('a * 'b) t
Creation
val from_iter : ( ( 'a -> unit ) -> unit ) -> 'a tBuild an iterator from a iter function
val from_labelled_iter : ( f:( 'a -> unit ) -> unit ) -> 'a tBuild an iterator from a labelled iter function
val from_fun : ( unit -> 'a option ) -> 'a tCall the function repeatedly until it returns None. This iterator is transient, use persistent if needed!
val empty : 'a tEmpty iterator. It contains no element.
val singleton : 'a -> 'a tSingleton iterator, with exactly one element.
val doubleton : 'a -> 'a -> 'a tIterator with exactly two elements
val init : ( int -> 'a ) -> 'a tinit f is the infinite iterator f 0; f 1; f 2; ….
val repeat : 'a -> 'a tInfinite iterator of the same element. You may want to look at take and the likes if you iterate on it.
val iterate : ( 'a -> 'a ) -> 'a -> 'a titerate f x is the infinite iterator x, f(x), f(f(x)), ...
val forever : ( unit -> 'b ) -> 'b tIterator that calls the given function to produce elements. The iterator may be transient (depending on the function), and definitely is infinite. You may want to use take and persistent.
Cycle forever through the given iterator. Assume the given iterator can be traversed any amount of times (not transient). This yields an infinite iterator, you should use something like take not to loop forever.
val unfoldr : ( 'b -> ('a * 'b) option ) -> 'b -> 'a tunfoldr f b will apply f to b. If it yields Some (x,b') then x is returned and unfoldr recurses with b'.
Consumption
val iter : ( 'a -> unit ) -> 'a t -> unitConsume the iterator, passing all its arguments to the function. Basically iter f seq is just seq f.
val iteri : ( int -> 'a -> unit ) -> 'a t -> unitIterate on elements and their index in the iterator
val for_each : 'a t -> ( 'a -> unit ) -> unitConsume the iterator, passing all its arguments to the function. for_each seq f is the same as iter f seq, i.e., iter with arguments reversed.
val for_eachi : 'a t -> ( int -> 'a -> unit ) -> unitIterate on elements and their index in the iterator. for_eachi seq f is the same as iteri f seq, i.e., iteri with arguments reversed.
val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'aFold over elements of the iterator, consuming it
val foldi : ( 'a -> int -> 'b -> 'a ) -> 'a -> 'b t -> 'aFold over elements of the iterator and their index, consuming it
val fold_filter_map :
+Iter (iter.Iter) Module Iter
Simple and Efficient Iterators
The iterators are designed to allow easy transfer (mappings) between data structures, without defining n^2 conversions between the n types. The implementation relies on the assumption that an iterator can be iterated on as many times as needed; this choice allows for high performance of many combinators. However, for transient iterators, the persistent function is provided, storing elements of a transient iterator in memory; the iterator can then be used several times (See further).
Note that some combinators also return iterators (e.g. group). The transformation is computed on the fly every time one iterates over the resulting iterator. If a transformation performs heavy computation, persistent can also be used as intermediate storage.
Most functions are lazy, i.e. they do not actually use their arguments until their result is iterated on. For instance, if one calls map on an iterator, one gets a new iterator, but nothing else happens until this new iterator is used (by folding or iterating on it).
If an iterator is built from an iteration function that is repeatable (i.e. calling it several times always iterates on the same set of elements, for instance List.iter or Map.iter), then the resulting t object is also repeatable. For one-time iter functions such as iteration on a file descriptor or a Seq, the persistent function can be used to iterate and store elements in a memory structure; the result is an iterator that iterates on the elements of this memory structure, cheaply and repeatably.
An iterator of values of type 'a. If you give it a function 'a -> unit it will be applied to every element of the iterator successively.
type +'a iter = 'a tNOTE Type ('a, 'b) t2 = ('a -> 'b -> unit) -> unit has been removed and subsumed by ('a * 'b) t
Creation
val from_iter : ( ( 'a -> unit ) -> unit ) -> 'a tBuild an iterator from a iter function
val from_labelled_iter : ( f:( 'a -> unit ) -> unit ) -> 'a tBuild an iterator from a labelled iter function
val from_fun : ( unit -> 'a option ) -> 'a tCall the function repeatedly until it returns None. This iterator is transient, use persistent if needed!
val empty : 'a tEmpty iterator. It contains no element.
val singleton : 'a -> 'a tSingleton iterator, with exactly one element.
val doubleton : 'a -> 'a -> 'a tIterator with exactly two elements
val init : ( int -> 'a ) -> 'a tinit f is the infinite iterator f 0; f 1; f 2; ….
val repeat : 'a -> 'a tInfinite iterator of the same element. You may want to look at take and the likes if you iterate on it.
val iterate : ( 'a -> 'a ) -> 'a -> 'a titerate f x is the infinite iterator x, f(x), f(f(x)), ...
val forever : ( unit -> 'b ) -> 'b tIterator that calls the given function to produce elements. The iterator may be transient (depending on the function), and definitely is infinite. You may want to use take and persistent.
Cycle forever through the given iterator. Assume the given iterator can be traversed any amount of times (not transient). This yields an infinite iterator, you should use something like take not to loop forever.
val unfoldr : ( 'b -> ('a * 'b) option ) -> 'b -> 'a tunfoldr f b will apply f to b. If it yields Some (x,b') then x is returned and unfoldr recurses with b'.
Consumption
val iter : ( 'a -> unit ) -> 'a t -> unitConsume the iterator, passing all its arguments to the function. Basically iter f seq is just seq f.
val iteri : ( int -> 'a -> unit ) -> 'a t -> unitIterate on elements and their index in the iterator
val for_each : 'a t -> ( 'a -> unit ) -> unitConsume the iterator, passing all its arguments to the function. for_each seq f is the same as iter f seq, i.e., iter with arguments reversed.
val for_eachi : 'a t -> ( int -> 'a -> unit ) -> unitIterate on elements and their index in the iterator. for_eachi seq f is the same as iteri f seq, i.e., iteri with arguments reversed.
val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'aFold over elements of the iterator, consuming it
val foldi : ( 'a -> int -> 'b -> 'a ) -> 'a -> 'b t -> 'aFold over elements of the iterator and their index, consuming it
val fold_filter_map :
( 'acc -> 'a -> 'acc * 'b option ) ->
'acc ->
'a t ->
@@ -37,13 +37,13 @@
( 'a -> 'b -> 'c ) ->
( 'a -> 'b -> 'd ) ->
('a * 'b) t ->
- ('c * 'd) tmap2_2 f g seq2 maps each x, y of seq2 into f x y, g x y
Data structures converters
val to_list : 'a t -> 'a listConvert the iterator into a list. Preserves order of elements. This function is tail-recursive, but consumes 2*n memory. If order doesn't matter to you, consider to_rev_list.
val to_rev_list : 'a t -> 'a listGet the list of the reversed iterator (more efficient than to_list)
val of_list : 'a list -> 'a ton_list f l is equivalent to to_list @@ f @@ of_list l.
val to_array : 'a t -> 'a arrayConvert to an array. Currently not very efficient because an intermediate list is used.
val of_array : 'a array -> 'a tval of_array_i : 'a array -> (int * 'a) tElements of the array, with their index
val array_slice : 'a array -> int -> int -> 'a tarray_slice a i j Iterator of elements whose indexes range from i to j
val of_opt : 'a option -> 'a tIterate on 0 or 1 values.
val of_seq : 'a Stdlib.Seq.t -> 'a tIterator of elements of a Seq.t.
val to_seq_persistent : 'a t -> 'a Stdlib.Seq.tConvert to a Seq. Linear in memory and time (a copy is made in memory). This does not work on infinite iterators.
val to_stack : 'a Stdlib.Stack.t -> 'a t -> unitPush elements of the iterator on the stack
val of_stack : 'a Stdlib.Stack.t -> 'a tIterator of elements of the stack (same order as Stack.iter)
val to_queue : 'a Stdlib.Queue.t -> 'a t -> unitPush elements of the iterator into the queue
val of_queue : 'a Stdlib.Queue.t -> 'a tIterator of elements contained in the queue, FIFO order
val hashtbl_add : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) t -> unitAdd elements of the iterator to the hashtable, with Hashtbl.add
val hashtbl_replace : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) t -> unitAdd elements of the iterator to the hashtable, with Hashtbl.replace (erases conflicting bindings)
val to_hashtbl : ('a * 'b) t -> ( 'a, 'b ) Stdlib.Hashtbl.tBuild a hashtable from an iterator of key/value pairs
val of_hashtbl : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) tIterator of key/value pairs from the hashtable
val hashtbl_keys : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a tval hashtbl_values : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'b tval of_str : string -> char tval to_str : char t -> stringval concat_str : string t -> stringConcatenate strings together, eagerly. Also see intersperse to add a separator.
Raised when the user tries to iterate several times on a transient iterator
val of_in_channel : Stdlib.in_channel -> char tIterates on characters of the input (can block when one iterates over the iterator). If you need to iterate several times on this iterator, use persistent.
val to_buffer : char t -> Stdlib.Buffer.t -> unitCopy content of the iterator into the buffer
val int_range : start:int -> stop:int -> int tIterator on integers in start...stop by steps 1. Also see (--) for an infix version.
val int_range_dec : start:int -> stop:int -> int tIterator on decreasing integers in stop...start by steps -1. See (--^) for an infix version
val int_range_by : step:int -> int -> int -> int tint_range_by ~step i j is the range starting at i, including j, where the difference between successive elements is step. use a negative step for a decreasing iterator.
val bools : bool tIterates on true and false
val of_set :
+ ('c * 'd) tmap2_2 f g seq2 maps each x, y of seq2 into f x y, g x y
Data structures converters
val to_list : 'a t -> 'a listConvert the iterator into a list. Preserves order of elements. This function is tail-recursive, but consumes 2*n memory. If order doesn't matter to you, consider to_rev_list.
val to_rev_list : 'a t -> 'a listGet the list of the reversed iterator (more efficient than to_list)
val of_list : 'a list -> 'a ton_list f l is equivalent to to_list @@ f @@ of_list l.
val to_array : 'a t -> 'a arrayConvert to an array. Currently not very efficient because an intermediate list is used.
val of_array : 'a array -> 'a tval of_array_i : 'a array -> (int * 'a) tElements of the array, with their index
val array_slice : 'a array -> int -> int -> 'a tarray_slice a i j Iterator of elements whose indexes range from i to j
val of_opt : 'a option -> 'a tIterate on 0 or 1 values.
val of_seq : 'a Stdlib.Seq.t -> 'a tIterator of elements of a Seq.t.
val to_seq_persistent : 'a t -> 'a Stdlib.Seq.tConvert to a Seq. Linear in memory and time (a copy is made in memory). This does not work on infinite iterators.
val to_stack : 'a Stdlib.Stack.t -> 'a t -> unitPush elements of the iterator on the stack
val of_stack : 'a Stdlib.Stack.t -> 'a tIterator of elements of the stack (same order as Stack.iter)
val to_queue : 'a Stdlib.Queue.t -> 'a t -> unitPush elements of the iterator into the queue
val of_queue : 'a Stdlib.Queue.t -> 'a tIterator of elements contained in the queue, FIFO order
val hashtbl_add : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) t -> unitAdd elements of the iterator to the hashtable, with Hashtbl.add
val hashtbl_replace : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) t -> unitAdd elements of the iterator to the hashtable, with Hashtbl.replace (erases conflicting bindings)
val to_hashtbl : ('a * 'b) t -> ( 'a, 'b ) Stdlib.Hashtbl.tBuild a hashtable from an iterator of key/value pairs
val of_hashtbl : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) tIterator of key/value pairs from the hashtable
val hashtbl_keys : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a tval hashtbl_values : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'b tval of_str : string -> char tval to_str : char t -> stringval concat_str : string t -> stringConcatenate strings together, eagerly. Also see intersperse to add a separator.
Raised when the user tries to iterate several times on a transient iterator
val of_in_channel : Stdlib.in_channel -> char tIterates on characters of the input (can block when one iterates over the iterator). If you need to iterate several times on this iterator, use persistent.
val to_buffer : char t -> Stdlib.Buffer.t -> unitCopy content of the iterator into the buffer
val int_range : start:int -> stop:int -> int tIterator on integers in start...stop by steps 1. Also see (--) for an infix version.
val int_range_dec : start:int -> stop:int -> int tIterator on decreasing integers in stop...start by steps -1. See (--^) for an infix version
val int_range_by : step:int -> int -> int -> int tint_range_by ~step i j is the range starting at i, including j, where the difference between successive elements is step. use a negative step for a decreasing iterator.
val bools : bool tIterates on true and false
val of_set :
(module Stdlib.Set.S with type elt = 'a and type t = 'b) ->
'b ->
'a tConvert the given set to an iterator. The set module must be provided.
val to_set :
(module Stdlib.Set.S with type elt = 'a and type t = 'b) ->
'a t ->
- 'bConvert the iterator to a set, given the proper set module
One shot iterator using this generator. It must not be traversed twice.
Sets
module Set : sig ... endMaps
module Map : sig ... endRandom iterators
val random_int : int -> int tInfinite iterator of random integers between 0 and the given higher bound (see Random.int)
val random_bool : bool tInfinite iterator of random bool values
val random_float : float -> float tval random_array : 'a array -> 'a tIterator of choices of an element in the array
val random_list : 'a list -> 'a tInfinite iterator of random elements of the list. Basically the same as random_array.
shuffle seq returns a perfect shuffle of seq. Uses O(length seq) memory and time. Eager.
shuffle_buffer n seq returns an iterator of element of seq in random order. The shuffling is *not* uniform. Uses O(n) memory.
The first n elements of the iterator are consumed immediately. The rest is consumed lazily.
Sampling
val sample : int -> 'a t -> 'a arraysample n seq returns k samples of seq, with uniform probability. It will consume the iterator and use O(n) memory.
It returns an array of size min (length seq) n.
Infix functions
module Infix : sig ... endinclude module type of Infix
val (--) : int -> int -> int ta -- b is the range of integers from a to b, both included, in increasing order. It will therefore be empty if a > b.
val (--^) : int -> int -> int ta --^ b is the range of integers from b to a, both included, in decreasing order (starts from a). It will therefore be empty if a < b.
Pretty printing
One shot iterator using this generator. It must not be traversed twice.
Sets
module Set : sig ... endMaps
module Map : sig ... endRandom iterators
val random_int : int -> int tInfinite iterator of random integers between 0 and the given higher bound (see Random.int)
val random_bool : bool tInfinite iterator of random bool values
val random_float : float -> float tval random_array : 'a array -> 'a tIterator of choices of an element in the array
val random_list : 'a list -> 'a tInfinite iterator of random elements of the list. Basically the same as random_array.
shuffle seq returns a perfect shuffle of seq. Uses O(length seq) memory and time. Eager.
shuffle_buffer n seq returns an iterator of element of seq in random order. The shuffling is *not* uniform. Uses O(n) memory.
The first n elements of the iterator are consumed immediately. The rest is consumed lazily.
Sampling
val sample : int -> 'a t -> 'a arraysample n seq returns k samples of seq, with uniform probability. It will consume the iterator and use O(n) memory.
It returns an array of size min (length seq) n.
Infix functions
module Infix : sig ... endinclude module type of Infix
val (--) : int -> int -> int ta -- b is the range of integers from a to b, both included, in increasing order. It will therefore be empty if a > b.
val (--^) : int -> int -> int ta --^ b is the range of integers from b to a, both included, in decreasing order (starts from a). It will therefore be empty if a < b.
Pretty printing
val pp_seq :
?sep:string ->
( Stdlib.Format.formatter -> 'a -> unit ) ->
Stdlib.Format.formatter ->
diff --git a/dev/iter/IterBigarray/index.html b/dev/iter/IterBigarray/index.html
index b029a76..2adee77 100644
--- a/dev/iter/IterBigarray/index.html
+++ b/dev/iter/IterBigarray/index.html
@@ -1,2 +1,2 @@
-IterBigarray (iter.IterBigarray) Module IterBigarray
Interface and Helpers for bigarrays
val of_bigarray : ( 'a, _, _ ) Stdlib.Bigarray.Array1.t -> 'a Iter.tIterate on the elements of a 1-D array
val mmap : string -> char Iter.tMap the file into memory, and read the characters.
\ No newline at end of file
+IterBigarray (iter.IterBigarray) Module IterBigarray
Interface and Helpers for bigarrays
val of_bigarray : ( 'a, _, _ ) Stdlib.Bigarray.Array1.t -> 'a Iter.tIterate on the elements of a 1-D array
val mmap : string -> char Iter.tMap the file into memory, and read the characters.
\ No newline at end of file
diff --git a/dev/iter/IterBigarrayShims_/index.html b/dev/iter/IterBigarrayShims_/index.html
index b700264..056c862 100644
--- a/dev/iter/IterBigarrayShims_/index.html
+++ b/dev/iter/IterBigarrayShims_/index.html
@@ -1,5 +1,5 @@
-IterBigarrayShims_ (iter.IterBigarrayShims_) Module IterBigarrayShims_
val bigarray_map_file :
+IterBigarrayShims_ (iter.IterBigarrayShims_) Module IterBigarrayShims_
val bigarray_map_file :
Unix.file_descr ->
( 'a, 'b ) Stdlib.Bigarray.kind ->
'c Stdlib.Bigarray.layout ->
diff --git a/dev/iter/IterLabels/IO/index.html b/dev/iter/IterLabels/IO/index.html
index 2fcf1bf..57c1a42 100644
--- a/dev/iter/IterLabels/IO/index.html
+++ b/dev/iter/IterLabels/IO/index.html
@@ -1,5 +1,5 @@
-IO (iter.IterLabels.IO) Module IterLabels.IO
val lines_of : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> string tlines_of filename reads all lines of the given file. It raises the same exception as would opening the file and read from it, except from End_of_file (which is caught). The file is always properly closed. Every time the iterator is iterated on, the file is opened again, so different iterations might return different results
val chunks_of :
+IO (iter.IterLabels.IO) Module IterLabels.IO
val lines_of : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> string tlines_of filename reads all lines of the given file. It raises the same exception as would opening the file and read from it, except from End_of_file (which is caught). The file is always properly closed. Every time the iterator is iterated on, the file is opened again, so different iterations might return different results
val chunks_of :
?mode:int ->
?flags:Stdlib.open_flag list ->
?size:int ->
diff --git a/dev/iter/IterLabels/Infix/index.html b/dev/iter/IterLabels/Infix/index.html
index 38d120c..2844809 100644
--- a/dev/iter/IterLabels/Infix/index.html
+++ b/dev/iter/IterLabels/Infix/index.html
@@ -1,2 +1,2 @@
-Infix (iter.IterLabels.Infix) Module IterLabels.Infix
val (--) : int -> int -> int ta -- b is the range of integers from a to b, both included, in increasing order. It will therefore be empty if a > b.
val (--^) : int -> int -> int ta --^ b is the range of integers from b to a, both included, in decreasing order (starts from a). It will therefore be empty if a < b.
\ No newline at end of file
+Infix (iter.IterLabels.Infix) Module IterLabels.Infix
val (--) : int -> int -> int ta -- b is the range of integers from a to b, both included, in increasing order. It will therefore be empty if a > b.
val (--^) : int -> int -> int ta --^ b is the range of integers from b to a, both included, in decreasing order (starts from a). It will therefore be empty if a < b.
\ No newline at end of file
diff --git a/dev/iter/IterLabels/Map/Adapt/index.html b/dev/iter/IterLabels/Map/Adapt/index.html
index eb409fb..15b211a 100644
--- a/dev/iter/IterLabels/Map/Adapt/index.html
+++ b/dev/iter/IterLabels/Map/Adapt/index.html
@@ -1,5 +1,5 @@
-Adapt (iter.IterLabels.Map.Adapt) Module Map.Adapt
Adapt a pre-existing Map module to make it iterator-aware
Parameters
Signature
include Stdlib.Map.S with type key = M.key with type 'a t = 'a M.t
val empty : 'a tval is_empty : 'a t -> boolval merge :
+Adapt (iter.IterLabels.Map.Adapt) Module Map.Adapt
Adapt a pre-existing Map module to make it iterator-aware
Parameters
Signature
include Stdlib.Map.S with type key = M.key with type 'a t = 'a M.t
val empty : 'a tval is_empty : 'a t -> boolval merge :
( key -> 'a option -> 'b option -> 'c option ) ->
'a t ->
'b t ->
diff --git a/dev/iter/IterLabels/Map/Make/index.html b/dev/iter/IterLabels/Map/Make/index.html
index a909162..9aadc56 100644
--- a/dev/iter/IterLabels/Map/Make/index.html
+++ b/dev/iter/IterLabels/Map/Make/index.html
@@ -1,5 +1,5 @@
-Make (iter.IterLabels.Map.Make) Module Map.Make
Create an enriched Map module, with iterator-aware functions
Parameters
Signature
include Stdlib.Map.S with type key = V.t
val empty : 'a tval is_empty : 'a t -> boolval merge :
+Make (iter.IterLabels.Map.Make) Module Map.Make
Create an enriched Map module, with iterator-aware functions
Parameters
Signature
include Stdlib.Map.S with type key = V.t
val empty : 'a tval is_empty : 'a t -> boolval merge :
( key -> 'a option -> 'b option -> 'c option ) ->
'a t ->
'b t ->
diff --git a/dev/iter/IterLabels/Map/index.html b/dev/iter/IterLabels/Map/index.html
index 95dd17d..d1d876b 100644
--- a/dev/iter/IterLabels/Map/index.html
+++ b/dev/iter/IterLabels/Map/index.html
@@ -1,4 +1,4 @@
-Map (iter.IterLabels.Map) Module IterLabels.Map
module type S = sig ... endmodule Adapt
+Map (iter.IterLabels.Map) Module IterLabels.Map
module type S = sig ... endAdapt a pre-existing Map module to make it iterator-aware
\ No newline at end of file
diff --git a/dev/iter/IterLabels/Map/module-type-S/index.html b/dev/iter/IterLabels/Map/module-type-S/index.html
index 2a4978a..4b7fef8 100644
--- a/dev/iter/IterLabels/Map/module-type-S/index.html
+++ b/dev/iter/IterLabels/Map/module-type-S/index.html
@@ -1,5 +1,5 @@
-S (iter.IterLabels.Map.S) Module type Map.S
include Stdlib.Map.S
val empty : 'a tval is_empty : 'a t -> boolval merge :
+S (iter.IterLabels.Map.S) Module type Map.S
include Stdlib.Map.S
val empty : 'a tval is_empty : 'a t -> boolval merge :
( key -> 'a option -> 'b option -> 'c option ) ->
'a t ->
'b t ->
diff --git a/dev/iter/IterLabels/Set/Adapt/index.html b/dev/iter/IterLabels/Set/Adapt/index.html
index 5c1a59e..e74b6a8 100644
--- a/dev/iter/IterLabels/Set/Adapt/index.html
+++ b/dev/iter/IterLabels/Set/Adapt/index.html
@@ -1,2 +1,2 @@
-Adapt (iter.IterLabels.Set.Adapt) Module Set.Adapt
Create an enriched Set module from the given one
Parameters
Signature
\ No newline at end of file
+Adapt (iter.IterLabels.Set.Adapt) Module Set.Adapt
Create an enriched Set module from the given one
Parameters
Signature
\ No newline at end of file
diff --git a/dev/iter/IterLabels/Set/Make/index.html b/dev/iter/IterLabels/Set/Make/index.html
index e77ba61..f29c3f3 100644
--- a/dev/iter/IterLabels/Set/Make/index.html
+++ b/dev/iter/IterLabels/Set/Make/index.html
@@ -1,2 +1,2 @@
-Make (iter.IterLabels.Set.Make) Module Set.Make
Functor to build an extended Set module from an ordered type
Parameters
Signature
\ No newline at end of file
+Make (iter.IterLabels.Set.Make) Module Set.Make
Functor to build an extended Set module from an ordered type
Parameters
Signature
\ No newline at end of file
diff --git a/dev/iter/IterLabels/Set/index.html b/dev/iter/IterLabels/Set/index.html
index ff89951..360f112 100644
--- a/dev/iter/IterLabels/Set/index.html
+++ b/dev/iter/IterLabels/Set/index.html
@@ -1,2 +1,2 @@
-Set (iter.IterLabels.Set) Module IterLabels.Set
module type S = sig ... endCreate an enriched Set module from the given one
\ No newline at end of file
+Set (iter.IterLabels.Set) Module IterLabels.Set
module type S = sig ... endCreate an enriched Set module from the given one
\ No newline at end of file
diff --git a/dev/iter/IterLabels/Set/module-type-S/index.html b/dev/iter/IterLabels/Set/module-type-S/index.html
index f7951cc..0173d58 100644
--- a/dev/iter/IterLabels/Set/module-type-S/index.html
+++ b/dev/iter/IterLabels/Set/module-type-S/index.html
@@ -1,2 +1,2 @@
-S (iter.IterLabels.Set.S) Module type Set.S
\ No newline at end of file
+S (iter.IterLabels.Set.S) Module type Set.S
\ No newline at end of file
diff --git a/dev/iter/IterLabels/index.html b/dev/iter/IterLabels/index.html
index 81d2679..68638e3 100644
--- a/dev/iter/IterLabels/index.html
+++ b/dev/iter/IterLabels/index.html
@@ -1,5 +1,5 @@
-IterLabels (iter.IterLabels) Module IterLabels
Simple and Efficient Iterators
Version of Iterator with labels
An iterator of values of type 'a. If you give it a function 'a -> unit it will be applied to every element of the iterator successively.
type +'a iter = 'a tNOTE Type ('a, 'b) t2 = ('a -> 'b -> unit) -> unit has been removed and subsumed by ('a * 'b) t
Creation
val from_iter : ( ( 'a -> unit ) -> unit ) -> 'a tBuild an iterator from a iter function
val from_labelled_iter : ( f:( 'a -> unit ) -> unit ) -> 'a tBuild an iterator from a labelled iter function
val from_fun : ( unit -> 'a option ) -> 'a tCall the function repeatedly until it returns None. This iterator is transient, use persistent if needed!
val empty : 'a tEmpty iterator. It contains no element.
val singleton : 'a -> 'a tSingleton iterator, with exactly one element.
val doubleton : 'a -> 'a -> 'a tIterator with exactly two elements
val init : f:( int -> 'a ) -> 'a tinit f is the infinite iterator f 0; f 1; f 2; ….
val repeat : 'a -> 'a tInfinite iterator of the same element. You may want to look at take and the likes if you iterate on it.
val iterate : ( 'a -> 'a ) -> 'a -> 'a titerate f x is the infinite iterator x, f(x), f(f(x)), ...
val forever : ( unit -> 'b ) -> 'b tIterator that calls the given function to produce elements. The iterator may be transient (depending on the function), and definitely is infinite. You may want to use take and persistent.
Cycle forever through the given iterator. Assume the given iterator can be traversed any amount of times (not transient). This yields an infinite iterator, you should use something like take not to loop forever.
Consumption
val iter : f:( 'a -> unit ) -> 'a t -> unitConsume the iterator, passing all its arguments to the function. Basically iter f seq is just seq f.
val iteri : f:( int -> 'a -> unit ) -> 'a t -> unitIterate on elements and their index in the iterator
val for_each : seq:'a t -> ( 'a -> unit ) -> unitConsume the iterator, passing all its arguments to the function. for_each seq f is the same as iter f seq, i.e., iter with arguments reversed.
val for_eachi : seq:'a t -> ( int -> 'a -> unit ) -> unitIterate on elements and their index in the iterator. for_eachi seq f is the same as iteri f seq, i.e., iteri with arguments reversed.
val fold : f:( 'a -> 'b -> 'a ) -> init:'a -> 'b t -> 'aFold over elements of the iterator, consuming it
val foldi : f:( 'a -> int -> 'b -> 'a ) -> init:'a -> 'b t -> 'aFold over elements of the iterator and their index, consuming it
val fold_filter_map :
+IterLabels (iter.IterLabels) Module IterLabels
Simple and Efficient Iterators
Version of Iterator with labels
An iterator of values of type 'a. If you give it a function 'a -> unit it will be applied to every element of the iterator successively.
type +'a iter = 'a tNOTE Type ('a, 'b) t2 = ('a -> 'b -> unit) -> unit has been removed and subsumed by ('a * 'b) t
Creation
val from_iter : ( ( 'a -> unit ) -> unit ) -> 'a tBuild an iterator from a iter function
val from_labelled_iter : ( f:( 'a -> unit ) -> unit ) -> 'a tBuild an iterator from a labelled iter function
val from_fun : ( unit -> 'a option ) -> 'a tCall the function repeatedly until it returns None. This iterator is transient, use persistent if needed!
val empty : 'a tEmpty iterator. It contains no element.
val singleton : 'a -> 'a tSingleton iterator, with exactly one element.
val doubleton : 'a -> 'a -> 'a tIterator with exactly two elements
val init : f:( int -> 'a ) -> 'a tinit f is the infinite iterator f 0; f 1; f 2; ….
val repeat : 'a -> 'a tInfinite iterator of the same element. You may want to look at take and the likes if you iterate on it.
val iterate : ( 'a -> 'a ) -> 'a -> 'a titerate f x is the infinite iterator x, f(x), f(f(x)), ...
val forever : ( unit -> 'b ) -> 'b tIterator that calls the given function to produce elements. The iterator may be transient (depending on the function), and definitely is infinite. You may want to use take and persistent.
Cycle forever through the given iterator. Assume the given iterator can be traversed any amount of times (not transient). This yields an infinite iterator, you should use something like take not to loop forever.
Consumption
val iter : f:( 'a -> unit ) -> 'a t -> unitConsume the iterator, passing all its arguments to the function. Basically iter f seq is just seq f.
val iteri : f:( int -> 'a -> unit ) -> 'a t -> unitIterate on elements and their index in the iterator
val for_each : seq:'a t -> ( 'a -> unit ) -> unitConsume the iterator, passing all its arguments to the function. for_each seq f is the same as iter f seq, i.e., iter with arguments reversed.
val for_eachi : seq:'a t -> ( int -> 'a -> unit ) -> unitIterate on elements and their index in the iterator. for_eachi seq f is the same as iteri f seq, i.e., iteri with arguments reversed.
val fold : f:( 'a -> 'b -> 'a ) -> init:'a -> 'b t -> 'aFold over elements of the iterator, consuming it
val foldi : f:( 'a -> int -> 'b -> 'a ) -> init:'a -> 'b t -> 'aFold over elements of the iterator and their index, consuming it
val fold_filter_map :
f:( 'acc -> 'a -> 'acc * 'b option ) ->
init:'acc ->
'a t ->
@@ -41,13 +41,13 @@
f:( 'a -> 'b -> 'c ) ->
( 'a -> 'b -> 'd ) ->
('a * 'b) t ->
- ('c * 'd) tmap2_2 f g seq2 maps each x, y of seq2 into f x y, g x y
Data structures converters
val to_list : 'a t -> 'a listConvert the iterator into a list. Preserves order of elements. This function is tail-recursive, but consumes 2*n memory. If order doesn't matter to you, consider to_rev_list.
val to_rev_list : 'a t -> 'a listGet the list of the reversed iterator (more efficient than to_list)
val of_list : 'a list -> 'a ton_list f l is equivalent to to_list @@ f @@ of_list l.
val to_array : 'a t -> 'a arrayConvert to an array. Currently not very efficient because an intermediate list is used.
val of_array : 'a array -> 'a tval of_array_i : 'a array -> (int * 'a) tElements of the array, with their index
val array_slice : 'a array -> int -> int -> 'a tarray_slice a i j Iterator of elements whose indexes range from i to j
val of_opt : 'a option -> 'a tIterate on 0 or 1 values.
val of_seq : 'a Stdlib.Seq.t -> 'a tIterator of elements of a Seq.t.
val to_seq_persistent : 'a t -> 'a Stdlib.Seq.tConvert to a Seq. Linear in memory and time (a copy is made in memory). This does not work on infinite iterators.
val to_stack : 'a Stdlib.Stack.t -> 'a t -> unitPush elements of the iterator on the stack
val of_stack : 'a Stdlib.Stack.t -> 'a tIterator of elements of the stack (same order as Stack.iter)
val to_queue : 'a Stdlib.Queue.t -> 'a t -> unitPush elements of the iterator into the queue
val of_queue : 'a Stdlib.Queue.t -> 'a tIterator of elements contained in the queue, FIFO order
val hashtbl_add : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) t -> unitAdd elements of the iterator to the hashtable, with Hashtbl.add
val hashtbl_replace : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) t -> unitAdd elements of the iterator to the hashtable, with Hashtbl.replace (erases conflicting bindings)
val to_hashtbl : ('a * 'b) t -> ( 'a, 'b ) Stdlib.Hashtbl.tBuild a hashtable from an iterator of key/value pairs
val of_hashtbl : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) tIterator of key/value pairs from the hashtable
val hashtbl_keys : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a tval hashtbl_values : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'b tval of_str : string -> char tval to_str : char t -> stringval concat_str : string t -> stringConcatenate strings together, eagerly. Also see intersperse to add a separator.
Raised when the user tries to iterate several times on a transient iterator
val of_in_channel : Stdlib.in_channel -> char tIterates on characters of the input (can block when one iterates over the iterator). If you need to iterate several times on this iterator, use persistent.
val to_buffer : char t -> Stdlib.Buffer.t -> unitCopy content of the iterator into the buffer
val int_range : start:int -> stop:int -> int tIterator on integers in start...stop by steps 1. Also see (--) for an infix version.
val int_range_dec : start:int -> stop:int -> int tIterator on decreasing integers in stop...start by steps -1. See (--^) for an infix version
val int_range_by : step:int -> start:int -> stop:int -> int tint_range_by ~step ~start:i ~stop:j is the range starting at i, including j, where the difference between successive elements is step. use a negative step for a decreasing iterator.
val bools : bool tIterates on true and false
val of_set :
+ ('c * 'd) tmap2_2 f g seq2 maps each x, y of seq2 into f x y, g x y
Data structures converters
val to_list : 'a t -> 'a listConvert the iterator into a list. Preserves order of elements. This function is tail-recursive, but consumes 2*n memory. If order doesn't matter to you, consider to_rev_list.
val to_rev_list : 'a t -> 'a listGet the list of the reversed iterator (more efficient than to_list)
val of_list : 'a list -> 'a ton_list f l is equivalent to to_list @@ f @@ of_list l.
val to_array : 'a t -> 'a arrayConvert to an array. Currently not very efficient because an intermediate list is used.
val of_array : 'a array -> 'a tval of_array_i : 'a array -> (int * 'a) tElements of the array, with their index
val array_slice : 'a array -> int -> int -> 'a tarray_slice a i j Iterator of elements whose indexes range from i to j
val of_opt : 'a option -> 'a tIterate on 0 or 1 values.
val of_seq : 'a Stdlib.Seq.t -> 'a tIterator of elements of a Seq.t.
val to_seq_persistent : 'a t -> 'a Stdlib.Seq.tConvert to a Seq. Linear in memory and time (a copy is made in memory). This does not work on infinite iterators.
val to_stack : 'a Stdlib.Stack.t -> 'a t -> unitPush elements of the iterator on the stack
val of_stack : 'a Stdlib.Stack.t -> 'a tIterator of elements of the stack (same order as Stack.iter)
val to_queue : 'a Stdlib.Queue.t -> 'a t -> unitPush elements of the iterator into the queue
val of_queue : 'a Stdlib.Queue.t -> 'a tIterator of elements contained in the queue, FIFO order
val hashtbl_add : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) t -> unitAdd elements of the iterator to the hashtable, with Hashtbl.add
val hashtbl_replace : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) t -> unitAdd elements of the iterator to the hashtable, with Hashtbl.replace (erases conflicting bindings)
val to_hashtbl : ('a * 'b) t -> ( 'a, 'b ) Stdlib.Hashtbl.tBuild a hashtable from an iterator of key/value pairs
val of_hashtbl : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) tIterator of key/value pairs from the hashtable
val hashtbl_keys : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a tval hashtbl_values : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'b tval of_str : string -> char tval to_str : char t -> stringval concat_str : string t -> stringConcatenate strings together, eagerly. Also see intersperse to add a separator.
Raised when the user tries to iterate several times on a transient iterator
val of_in_channel : Stdlib.in_channel -> char tIterates on characters of the input (can block when one iterates over the iterator). If you need to iterate several times on this iterator, use persistent.
val to_buffer : char t -> Stdlib.Buffer.t -> unitCopy content of the iterator into the buffer
val int_range : start:int -> stop:int -> int tIterator on integers in start...stop by steps 1. Also see (--) for an infix version.
val int_range_dec : start:int -> stop:int -> int tIterator on decreasing integers in stop...start by steps -1. See (--^) for an infix version
val int_range_by : step:int -> start:int -> stop:int -> int tint_range_by ~step ~start:i ~stop:j is the range starting at i, including j, where the difference between successive elements is step. use a negative step for a decreasing iterator.
val bools : bool tIterates on true and false
val of_set :
(module Stdlib.Set.S with type elt = 'a and type t = 'b) ->
'b ->
'a tConvert the given set to an iterator. The set module must be provided.
val to_set :
(module Stdlib.Set.S with type elt = 'a and type t = 'b) ->
'a t ->
- 'bConvert the iterator to a set, given the proper set module
Sets
module Set : sig ... endMaps
module Map : sig ... endRandom iterators
val random_int : int -> int tInfinite iterator of random integers between 0 and the given higher bound (see Random.int)
val random_bool : bool tInfinite iterator of random bool values
val random_float : float -> float tval random_array : 'a array -> 'a tIterator of choices of an element in the array
val random_list : 'a list -> 'a tInfinite iterator of random elements of the list. Basically the same as random_array.
shuffle seq returns a perfect shuffle of seq. Uses O(length seq) memory and time. Eager.
shuffle_buffer n seq returns an iterator of element of seq in random order. The shuffling is not uniform. Uses O(n) memory.
The first n elements of the iterator are consumed immediately. The rest is consumed lazily.
Sampling
val sample : n:int -> 'a t -> 'a arraysample n seq returns k samples of seq, with uniform probability. It will consume the iterator and use O(n) memory.
It returns an array of size min (length seq) n.
Infix functions
module Infix : sig ... endinclude module type of Infix
val (--) : int -> int -> int ta -- b is the range of integers from a to b, both included, in increasing order. It will therefore be empty if a > b.
val (--^) : int -> int -> int ta --^ b is the range of integers from b to a, both included, in decreasing order (starts from a). It will therefore be empty if a < b.
Pretty printing
One shot iterator using this generator. It must not be traversed twice.
Sets
module Set : sig ... endMaps
module Map : sig ... endRandom iterators
val random_int : int -> int tInfinite iterator of random integers between 0 and the given higher bound (see Random.int)
val random_bool : bool tInfinite iterator of random bool values
val random_float : float -> float tval random_array : 'a array -> 'a tIterator of choices of an element in the array
val random_list : 'a list -> 'a tInfinite iterator of random elements of the list. Basically the same as random_array.
shuffle seq returns a perfect shuffle of seq. Uses O(length seq) memory and time. Eager.
shuffle_buffer n seq returns an iterator of element of seq in random order. The shuffling is not uniform. Uses O(n) memory.
The first n elements of the iterator are consumed immediately. The rest is consumed lazily.
Sampling
val sample : n:int -> 'a t -> 'a arraysample n seq returns k samples of seq, with uniform probability. It will consume the iterator and use O(n) memory.
It returns an array of size min (length seq) n.
Infix functions
module Infix : sig ... endinclude module type of Infix
val (--) : int -> int -> int ta -- b is the range of integers from a to b, both included, in increasing order. It will therefore be empty if a > b.
val (--^) : int -> int -> int ta --^ b is the range of integers from b to a, both included, in decreasing order (starts from a). It will therefore be empty if a < b.
Pretty printing
val pp_seq :
?sep:string ->
( Stdlib.Format.formatter -> 'a -> unit ) ->
Stdlib.Format.formatter ->
diff --git a/dev/iter/Iter_shims_/index.html b/dev/iter/Iter_shims_/index.html
index 6312d00..c5d8c3d 100644
--- a/dev/iter/Iter_shims_/index.html
+++ b/dev/iter/Iter_shims_/index.html
@@ -1,2 +1,2 @@
-Iter_shims_ (iter.Iter_shims_) Module Iter_shims_
\ No newline at end of file
+Iter_shims_ (iter.Iter_shims_) Module Iter_shims_
\ No newline at end of file
diff --git a/dev/iter/index.html b/dev/iter/index.html
index e7cf9d5..54949f1 100644
--- a/dev/iter/index.html
+++ b/dev/iter/index.html
@@ -1,2 +1,2 @@
-index (iter.index) iter index
Library iter
This library exposes the following toplevel modules:
Library iter.bigarray
This library exposes the following toplevel modules:
\ No newline at end of file
+index (iter.index) iter index
\ No newline at end of file
diff --git a/dev/odoc.css b/dev/odoc.css
index 5362774..edc8a2b 100644
--- a/dev/odoc.css
+++ b/dev/odoc.css
@@ -1,7 +1,7 @@
@charset "UTF-8";
/* Copyright (c) 2016 The odoc contributors. All rights reserved.
Distributed under the ISC license, see terms at the end of the file.
- odoc 2.1.0 */
+ odoc 2.1.1 */
/* Fonts */
@import url('https://fonts.googleapis.com/css?family=Fira+Mono:400,500');