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.
Sourcetype 'a node = | Nil| Cons of 'a * 'a tView type to decompose and build streams.
Constructors
Append an element in front of a stream.
Internalize the laziness of a stream.
Destructors
Whethere a stream is empty.
Return the head and the tail of a stream, if any.
Standard operations
All stream-returning functions are lazy. The other ones are eager.
Append two streams. Not tail-rec.
Sourceval map : ('a -> 'b) -> 'a t -> 'b t Mapping of streams. Not tail-rec.
Sourceval iter : ('a -> unit) -> 'a t -> unit Sourceval fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a Appends recursively a stream of streams.
Sourceval map_filter : ('a -> 'b option) -> 'a t -> 'b t Mixing map and filter. Not tail-rec.
Sourceval concat_map : ('a -> 'b t) -> 'a t -> 'b t concat_map f l is the same as concat (map f l).
Conversions
Sourceval of_list : 'a list -> 'a t Convert a list into a stream.
Sourceval to_list : 'a t -> 'a list Convert a stream into a list.
Other