From: Stefano Z. <za...@bo...> - 2003-03-02 09:41:21
|
On Fri, Feb 28, 2003 at 07:47:34PM -0500, Manos Renieris wrote: > Of course, that means that we need the equivalent iter, map, and fold > in Stream, like > val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b Stream.t -> 'a > val map : ('a -> 'b) -> 'a Stream.t -> 'b Stream.t Those functions could be useful also by themselves and IMO should be added to the Stream module. BTW the Stream.map function simplest implementation is: let map f s = Stream.from (fun _ -> Some (f (next s))) anyway using such an implementation you will get a stream that couldn't be mixed with "normal" streams (i.e. streams not built using Stream.from), this can be ok, but should be definitely mentioned. Cheers. -- Stefano Zacchiroli - Undergraduate Student of CS @ Uni. Bologna, Italy zack@{cs.unibo.it,debian.org,bononia.it} - http://www.bononia.it/zack/ " I know you believe you understood what you think I said, but I am not sure you realize that what you heard is not what I meant! " -- G.Romney |