mk_istreamLib.mk_istream : ('a -> 'a) -> 'a -> ('a -> 'b) -> ('a,'b) istream
Create a stream.
An application mk_istream trans init proj creates an
imperative stream of elements. The stream is generated by applying
trans to the state. The first element in the stream state
is init. The value of the state is obtained by applying
proj.
If an application of trans or proj fails
when applied to the state.
The following creates a stream of distinct strings.
- mk_istream (fn x => x+1) 0 (concat "gsym" o int_to_string);
> val it = <istream> : (int, string) istream
It is aesthetically unpleasant that the underlying implementation type is visible.
See any book on ML programming to see how functional streams are built.