Version française
Home     About     Download     Resources     Contact us    
Browse thread
Stream standard library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Coscoy, Yann <yann.coscoy@i...>
Subject: Stream standard library

  I have the impression that it would be useful to have some other
constructors in standard module Stream. I feel quite limited with "from :
('int -> 'a option) -> 'a t".

  I suggest to had the functions:

val map_list : ('a -> 'b list) -> 'a t -> 'b t

val from_list : (int -> 'a list option) -> 'a t

  Other possibilities are:

val mapi_list : (int -> 'a -> 'b list) -> 'a t -> 'b t
  (with stream counter)

val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
  (these functions are to restricted in my opinion)

val from_list : (int -> 'a list) -> 'a t
  (an empty list specifies end of stream)

  It would be interesting if other ocaml users give their opinion on the
topics. Are these functions suitable in a standard library? What would
be the best function names and function types?
 
  Best regards,

    Yann Coscoy

---------------------------------------------------------------------
Yann Coscoy
Informatique CDC - Direction des Techniques Avancées
4, rue Berthollet
94110 Arcueil
Tél. : 01 40 49 15 28
Fax. : 01 40 49 15 78
e-mail : Yann.Coscoy@icdc.caissedesdepots.fr