(* Concatenate module boxes from multiple files into an horizontal arrangment. *) let max_h = ref 0 let read_file fn = let ic = open_in fn in let l = ref [] in (try while true do l := (input_line ic) :: !l done with End_of_file -> ()); close_in ic; if List.length !l > !max_h then max_h := List.length !l; Array.of_list (List.rev !l) let nfiles = Array.length Sys.argv - 1 let files = Array.init nfiles (fun i -> read_file (Sys.argv.(i+1))) ;; for y = 0 to !max_h - 1 do Array.iter (fun lines -> if y >= Array.length lines then print_string (String.make (String.length lines.(0)) ' ') else print_string lines.(y) ) files; print_newline () done