let lines_of_file ?(f=fun x -> x) file = let chan = (open_in file) in
let rec input_lines_helper res =
let sl =
try
Some (input_line chan)
with
End_of_file -> None
in
match sl with
None -> List.rev res
| Some l -> input_lines_helper ((f l) :: res)
in
input_lines_helper []