+ let gcp x y =
+ (* explode and implode from the OCaml Expert FAQ. *)
+ let explode s =
+ let rec exp i l =
+ if i < 0 then l else exp (i - 1) (s.[i] :: l) in
+ exp (String.length s - 1) []
+ in
+ let implode l =
+ let res = String.create (List.length l) in
+ let rec imp i = function
+ | [] -> res
+ | c :: l -> res.[i] <- c; imp (i + 1) l in
+ imp 0 l
+ in
+ let rec aux = function
+ | x::tl1,y::tl2 when x = y -> x::(aux (tl1,tl2))
+ | _ -> []
+ in
+ implode (aux (explode x,explode y))
+ in
+ let max_path = List.hd ma_files in
+ let max_path = List.fold_left gcp max_path ma_files in
+ let short x = Pcre.replace ~pat:("^"^max_path) x in