Support.Seq
include module type of Stdlib.Seq
type !'a t = unit -> 'a node
val is_empty : 'a t -> bool
val length : 'a t -> int
val iter : ('a -> unit) -> 'a t -> unit
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
val iteri : (int -> 'a -> unit) -> 'a t -> unit
val fold_lefti : ('b -> int -> 'a -> 'b) -> 'b -> 'a t -> 'b
val for_all : ('a -> bool) -> 'a t -> bool
val exists : ('a -> bool) -> 'a t -> bool
val find : ('a -> bool) -> 'a t -> 'a option
val find_map : ('a -> 'b option) -> 'a t -> 'b option
val empty : 'a t
val return : 'a -> 'a t
val init : int -> (int -> 'a) -> 'a t
val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t
val repeat : 'a -> 'a t
val forever : (unit -> 'a) -> 'a t
val iterate : ('a -> 'a) -> 'a -> 'a t
val of_dispenser : (unit -> 'a option) -> 'a t
val to_dispenser : 'a t -> unit -> 'a option
val ints : int -> int t
val of_gen : (unit -> 'a option) -> 'a t
of_gen g
is the sequence obtained by sequentially invoking the effectful function g
to produce the next element x
when g () = Option.Some x
.
If it is ever the case that g () = Option.None
, then the resultant sequence has finite length.
val of_list : 'a list -> 'a t
of_list l
is the sequence obtained from the list l
.
val to_list : 'a t -> 'a list
to_list s
converts s
to a list. The sequence traversal happens immediately and will not terminate on infinite sequences.