> (** Some useful operators on int and double references. *)
> let (+=) r i = r := !r + i; !r
> let (-=) r i = r := !r - i; !r
> let ( *=) r i = r := !r * i; !r
> let (/=) r i = r := !r / i; !r
> let (+.=) r d = r := !r +. d; !r
> let (-.=) r d = r := !r -. d; !r
> let ( *.=) r d = r := !r *. d; !r
> let (/.=) r d = r := !r /. d; !r
Theses are convenient for C users.
Why not, but this is matter of taste, not really a additional functionality
> (** eg. homedir // "file". *)
> let (//) = Filename.concat
>
> (** list |> List.iter (fun ... -> ...) *)
> let (|>) a f = f a
Same for theses
> (** The 'lost' conversion function from pervasives. *)
> let string_of_char c =
> let s = String.create 1 in
> s.[0] <- c;
> s
open ExtString;
String.of_char is doing the job.
[...]
> (** Return true if a string starts with another string. *)
> let starts_with str prefix =
> let len = String.length prefix in
> (String.sub str 0 len) = prefix
>
> (** Return true if a string ends with another string. *)
> let ends_with str suffix =
> let len = String.length str in
> let sflen = String.length suffix in
> (String.sub str (len-sflen) sflen) = suffix
ends_with is already in ExtString.
I will add starts_with (sounds logical to have both).
BTW your implementation of starts_with raise an exception if strlen(prefix)
> strlen(str) !
> let readdir_all dirname =
> let is_dir path =
> let is_dir_lstat path =
> let copy_file src dest =
> let rec delete_directory path =
Theses are looking useful but not complete, I think that we need a module
full a functions for file/directory access, creating , copying and moving.
If s/one is willing to write it....
> let buffer_of_chan chan =
We already have this one :
Std.input_all : in_channel -> string
Nicolas Cannasse
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|