module Streamutil:Stream creation, parsing, and manipulation utilitiessig..end
These functions create new streams.
val of_channel_lines : Pervasives.in_channel -> string Stream.tval of_channel_blocks : Pervasives.in_channel -> int -> string Stream.t
These utilities work on streams, returning a new lazy stream that
reflects the changes.
val filter : ('a -> bool) -> 'a Stream.t -> 'a Stream.tval map : ('a -> 'b) -> 'a Stream.t -> 'b Stream.tval map_stream : ('a -> 'b Stream.t) -> 'a Stream.t -> 'b Stream.t
Unlike Streamutil.map, which expects func to take a single element and
return a single element, this function expects func to take a single element
and return a stream. This is a powerful capability that allows func
to grow or shrink the results of processing the single element.
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b Stream.t -> 'aval to_list : 'a Stream.t -> 'a listval take : int -> 'a Stream.t -> 'a Stream.tval drop : int -> 'a Stream.t -> unit
These do something with a stream, and generally consume its elements
completely.
val output_lines : Pervasives.out_channel -> string Stream.t -> unitStreamutil.of_channel_lines,
output a line containing each element from the stream. The input stream
is expected to not have newlines (those will be added automaticaly.)val output_chars : Pervasives.out_channel -> char Stream.t -> unitStream.of_channel), output the characters representing each element from
the stream.
These functions are used to parse streams.
val optparse : ('a -> 'b) -> 'b list -> 'a -> 'b listfunc : The parser function. Will be called repeatedly until
Stream.Failure is raised.accum : Accumulator -- pass [] to it to start with.args : Passed to func.val optparse_1 : ('a -> 'b) -> ('a -> 'b) -> 'b list -> 'a -> 'b listfunchead : Function to apply to first elementfunctail : Function to apply to remaining argumentsaccum : Accumulator -- pass [] to start withargs : Passed to the various functionsval optparse_1_folded : ('a -> 'b) -> ('c -> 'b -> 'c) -> 'c -> 'a -> 'cfunc : Parser functioncombinefunc : Combination function used for foldingstartval : Starting value for foldingargs : Parser argumentsval optparse_1_string : ('a -> string) -> 'a -> stringfunc : Parser functionargs : Arguments