Typo
[mediawiki.git] / math / util.ml
blobece0160540dbbfad7c2931d3c46d679cf795a6d7
1 (* vim: set sw=8 ts=8 et: *)
3 (* TODO document *)
4 let mapjoin f l = (List.fold_left (fun a b -> a ^ (f b)) "" l)
6 (* TODO document *)
7 let mapjoine e f = function
8 [] -> ""
9 | h::t -> (List.fold_left (fun a b -> a ^ e ^ (f b)) (f h) t)
11 (* Exception used by open_out_unless_exists below *)
12 exception FileAlreadyExists
14 (* Wrapper which raise an exception when output path already exist *)
15 let open_out_unless_exists path =
16 if Sys.file_exists path
17 then raise FileAlreadyExists
18 else open_out path
20 (* *)
21 let run_in_other_directory tmppath cmd =
22 let prevdir = Sys.getcwd () in(
23 Sys.chdir tmppath;
24 let retval = Sys.command cmd in
25 (Sys.chdir prevdir; retval)