Followup to r70638: Clean up code, add prop to function args, add comment
[lhc/web/wiklou.git] / math / util.ml
1 let mapjoin f l = (List.fold_left (fun a b -> a ^ (f b)) "" l)
2 let mapjoine e f = function
3 [] -> ""
4 | h::t -> (List.fold_left (fun a b -> a ^ e ^ (f b)) (f h) t)
5
6 exception FileAlreadyExists
7 let open_out_unless_exists path =
8 if Sys.file_exists path
9 then raise FileAlreadyExists
10 else open_out path
11
12 let run_in_other_directory tmppath cmd =
13 let prevdir = Sys.getcwd () in(
14 Sys.chdir tmppath;
15 let retval = Sys.command cmd in
16 (Sys.chdir prevdir; retval)
17 )