and y = In_channel.input_line channel |> Option.get |> int_of_string in
let chunk =
Array.init chunk_size (fun _ ->
- Array.init chunk_size (fun _ ->
- (In_channel.input_line channel |> Option.get).[0]
- |> M.of_char
- |> Option.get))
+ let l = In_channel.input_line channel |> Option.get in
+ Array.init chunk_size (fun i -> l.[i] |> M.of_char |> Option.get))
in
aux (CoordMap.add (x, y) chunk board)
in
CoordMap.iter
(fun (x, y) chunk ->
Printf.fprintf channel "%d\n%d\n" x y;
- Array.iter (Array.iter (fun c -> Printf.fprintf channel "%c\n" (M.to_char c))) chunk)
+ Array.iter
+ (fun l ->
+ Array.iter (fun c -> Printf.fprintf channel "%c" (M.to_char c)) l;
+ Printf.fprintf channel "\n")
+ chunk)
board
let automata =