From: Nicolas C. <war...@fr...> - 2003-02-28 03:39:04
|
> > That would help. Thanks. > > - val String.explode : string -> char list > - val String.implode : char list -> string Agree > (* like perl's chomp function, remove trailing newline characters *) > - val String.chomp : string -> string Uhm, why not, but this need some discuss on implementation since newline is "\r\n" under windows and "\n" under *nix.... > (* fold left on file lines (without trailing newline), I don't know in > which module this functions should go, maybe Sys? *) > - val fold_file : ('a -> string -> 'a) -> 'a -> string -> 'a > (* iter on file lines *) > - val iter_file : (string -> unit) -> string -> unit perhaps : val iter_in : (string -> unit) -> in_channel -> unit val map_in : (string -> 'a) -> in_channel -> 'a list val fold_in : ('a -> string -> 'a) -> 'a -> in_channel -> 'a are better so it can work on many kind of descriptors and does not have to handle the "file not found" problems I propose also : val read_lines : in_channel -> string list val read_all : in_channel -> string that returns all the contents ( up to End_of_file ) > - val Dbm.fold_left Uh, never used Dbm... > - val Hashtbl.keys : ('a, 'b) Hashtbl.t -> 'a list > - val Hashtbl.values : ('a, 'b) Hashtbl.t -> 'b list > (* remove all bindings of a given keys *) > - val Hashtbl.remove_all : ('a, 'b) Hashtbl.t -> 'a -> unit Agree > (* like Hashtbl.fold but working on ordered key list. Find a better > name!, compare defaults to Pervasives.compare *) > - val Hashtbl.sorted_fold: ?compare: ('a -> 'a -> int) -> ('a -> 'b -> 'c -> 'c) -> ('a, 'b) Hashtbl.t -> 'c -> 'c > (* as above for iter *) > - val Hashtbl.sorted_iter: ?compare: ('a -> 'a -> int) -> ('a -> 'b -> unit) -> ('a, 'b) Hashtbl.t -> unit Aren't theses strange and very particular ones ?? > (* return all bindings of a given key *) > - val List.assoc_all: 'a -> ('a * 'b) list -> 'b list > (* as above but use physical equality *) > - val List.assq_all: 'a -> ('a * 'b) list -> 'b list > - val Sys.copy: src:string -> dst:string -> unit > > (* add support for recursive directory creation for Unix.mkdir *) > - support for "-p" to Unix.mkdir > - Unix.is_directory : ?follow_sym_link: bool -> string -> bool > - Unix.is_regular > - Unix.is_symlink > - ... (* predicates over filenames, optional argument defaults to false, > if it is true predicate are over symlink target *) > (* return size of a given file; maybe Sys.filesize? *) > - Unix.filesize : string -> bool > (* "/ls" command interface *) > - Unix.ls : string -> string list All theses cannot be part of the ExtLib, since we're only focusing right now on the StdLib Extension ( and Unix is not part of the StdLib altought it's part of the standard distribution ) and also theses function need some C code to work. > - val Random.char: unit -> char > - val Random.stringi: int -> char (* argument is string length *) Don't like theses > (* predicate negation *) > - val non: ('a -> bool) -> ('a -> bool) Since there is some need for such basic functions, let's put that in a module Logic > (* given a 'a option returns the 'a value if it's Some _ or raise an > exception, find a better name! *) > - val unsome : 'a option -> 'a Global is much more complete Thanks, Nicolas Cannasse |