diff --git a/dev/index.html b/dev/index.html index e769887..8dcda4e 100644 --- a/dev/index.html +++ b/dev/index.html @@ -11,7 +11,7 @@
diff --git a/dev/iter/Iter/index.html b/dev/iter/Iter/index.html index a60ddab..957f0d9 100644 --- a/dev/iter/Iter/index.html +++ b/dev/iter/Iter/index.html @@ -24,7 +24,7 @@ ('a * 'b list) tgroup_join_by key2 associates to every element x of the first iterator, all the elements y of the second iterator such that eq x (key y). Elements of the first iterators without corresponding values in the second one are mapped to [] precondition: for any x and y, if eq x y then hash x=hash y must hold.
Intersection of two collections. Each element will occur at most once in the result. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.
Union of two collections. Each element will occur at most once in the result. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.
subset a b returns true if all elements of a belong to b. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.
val max : ?lt:('a -> 'a -> bool) -> 'a t -> 'a optionMax element of the iterator, using the given comparison function.
val min : ?lt:('a -> 'a -> bool) -> 'a t -> 'a optionMin element of the iterator, using the given comparison function. see max for more details.
val sum : int t -> intSum of elements
val sumf : float t -> floatSum of elements, using Kahan summation
val head : 'a t -> 'a optionFirst element, if any, otherwise None
val head_exn : 'a t -> 'aFirst element, if any, fails
Take at most n elements from the iterator. Works on infinite iterators.
Take elements while they satisfy the predicate, then stops iterating. Will work on an infinite iterator s if the predicate is false for at least one element of s.
Maps over elements of the iterator, stopping early if the mapped function returns `Stop or `Return x. At each iteration:
f returns `Yield y, y is added to the sequence and the iteration continues.f returns `Stop, nothing is added to the sequence and the iteration stops.f returns `Return y, y is added to the sequence and the iteration stops.val fold_while : ('a -> 'b -> 'a * [ `Stop | `Continue ]) -> 'a -> 'b t -> 'aFolds over elements of the iterator, stopping early if the accumulator returns ('a, `Stop)
Reverse the iterator. O(n) memory and time, needs the iterator to be finite. The result is persistent and does not depend on the input being repeatable.
val fold2 : ('c -> 'a -> 'b -> 'c) -> 'c -> ('a * 'b) t -> 'cval iter2 : ('a -> 'b -> unit) -> ('a * 'b) t -> unitmap2_2 f g seq2 maps each x, y of seq2 into f x y, g x y
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 :
+ 'b tMaps over elements of the iterator, stopping early if the mapped function returns `Stop or `Return x. At each iteration:
f returns `Yield y, y is added to the sequence and the iteration continues.f returns `Stop, nothing is added to the sequence and the iteration stops.f returns `Return y, y is added to the sequence and the iteration stops.val fold_while : ('a -> 'b -> 'a * [ `Stop | `Continue ]) -> 'a -> 'b t -> 'aFolds over elements of the iterator, stopping early if the accumulator returns ('a, `Stop)
Reverse the iterator. O(n) memory and time, needs the iterator to be finite. The result is persistent and does not depend on the input being repeatable.
val fold2 : ('c -> 'a -> 'b -> 'c) -> 'c -> ('a * 'b) t -> 'cval iter2 : ('a -> 'b -> unit) -> ('a * 'b) t -> unitmap2_2 f g seq2 maps each x, y of seq2 into f x y, g x y
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.