summaryrefslogtreecommitdiff
path: root/math/util.ml
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
commit9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch)
tree46d1a0dee7febef5c2d57a9f7b972be16a163b3d /math/util.ml
parent78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff)
update to MediaWiki 1.17.0
Diffstat (limited to 'math/util.ml')
-rw-r--r--math/util.ml15
1 files changed, 12 insertions, 3 deletions
diff --git a/math/util.ml b/math/util.ml
index f0458562..ece01605 100644
--- a/math/util.ml
+++ b/math/util.ml
@@ -1,17 +1,26 @@
+(* vim: set sw=8 ts=8 et: *)
+
+(* TODO document *)
let mapjoin f l = (List.fold_left (fun a b -> a ^ (f b)) "" l)
+
+(* TODO document *)
let mapjoine e f = function
[] -> ""
| h::t -> (List.fold_left (fun a b -> a ^ e ^ (f b)) (f h) t)
+(* Exception used by open_out_unless_exists below *)
exception FileAlreadyExists
+
+(* Wrapper which raise an exception when output path already exist *)
let open_out_unless_exists path =
if Sys.file_exists path
then raise FileAlreadyExists
else open_out path
+(* *)
let run_in_other_directory tmppath cmd =
let prevdir = Sys.getcwd () in(
- Sys.chdir tmppath;
- let retval = Sys.command cmd in
- (Sys.chdir prevdir; retval)
+ Sys.chdir tmppath;
+ let retval = Sys.command cmd in
+ (Sys.chdir prevdir; retval)
)