Module Fang_iter.Iter
type 'a t
= 'a iter
Building iterators
val empty : _ t
empty
is an iterator which doesn't iterate over any values.
val one : 'a -> 'a t
one x
iterates over the valuex
and no others.
val adapt : (('a -> unit) -> 'b -> unit) -> 'b -> 'a t
The modules for many standard containers already have a function for invoking a function to each item.
For example,
List.iter (fun x -> print_int x) [1; 2; 3]
willy invoke
fun x -> print_int x
for each item in the list.adapt f xs
produces an iterator for a containerxs
given an iteration functionf
likeList
.iter.For example,
adapt List.iter [1; 2; 3]
is an
int t
which will iterate over the values[1; 2; 3]
.
Transformations
Searching
Folding
Pretty-printing
val pp : ?sep:unit Fmt.t -> 'a Fmt.t -> 'a t Fmt.t