Tidy up 2024 day 11 code.

This commit is contained in:
2024-12-11 15:45:27 +00:00
parent fcc4341237
commit c81de6e642
3 changed files with 36 additions and 25 deletions

View File

@@ -6,6 +6,11 @@ let distance1 a b = abs (a - b)
let strings_of_file fname =
In_channel.with_open_text fname In_channel.input_lines
let string_of_file fname =
match In_channel.with_open_text fname In_channel.input_line with
| Some x -> x
| None -> failwith "Aoc.string_of_file"
let main prep parts =
try
match Sys.argv with

View File

@@ -9,6 +9,9 @@ val strings_of_file : string -> string list
(** [strings_from_file fname] returns a list of strings from the file [fname].
Each string represents a line from the file. *)
val string_of_file : string -> string
(** [string_of_file fname] returns the first line in [fname]. *)
val log10i : int -> int
(** [log10i n] returns the floor of [(log10 (float_of_int n))]. [n] must be
positive. *)