Module IStream
Purely functional streams
Contrarily to OCaml module Stream
, these are meant to be used purely functionally. This implies in particular that accessing an element does not discard it.
type 'a node
=
|
Nil
|
Cons of 'a * 'a t
View type to decompose and build streams.
Constructors
val empty : 'a t
The empty stream.
Destructors
val is_empty : 'a t -> bool
Whethere a stream is empty.
Standard operations
All stream-returning functions are lazy. The other ones are eager.
val iter : ('a -> unit) -> 'a t -> unit
Iteration over streams.
val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
Fold over streams.
Conversions
val of_list : 'a list -> 'a t
Convert a list into a stream.
val to_list : 'a t -> 'a list
Convert a stream into a list.