(* an infinite list of values with type 'a *) type 'a stream (* const v is an infinite list of values v *) val const : 'a -> 'a stream (* return the first element and the stream that follows it *) val next : 'a stream -> 'a * 'a stream (* cons x f is the stream with x followed by f() *) val cons : 'a -> (unit -> 'a stream) -> 'a stream (* filter pred s: * * return a new stream s' containing only those elements v of s * * such that pred v == true *) val filter : ('a -> bool) -> 'a stream -> 'a stream (* map f s: * * apply f to all elements of an infinite stream *) val map : ('a -> 'b) -> 'a stream -> 'b stream (* scan f b s: * if s is the stream v0; v1; v2; ... then return the stream * * f b v0; f (f b v0) v1; f (f (f b v0) v1) v2; ... *) val scan : ('b -> 'a -> 'b) -> 'b -> 'a stream -> 'b stream