1
0
Fork 0
advent-of-code-2022/ocaml/lib/utils.ml

17 lines
343 B
OCaml
Raw Permalink Normal View History

2023-01-11 12:35:10 +00:00
let read_file filename =
let ch = open_in filename in
let s = really_input_string ch (in_channel_length ch) in
close_in ch;
s
2023-01-19 15:37:55 +00:00
;;
2023-01-12 23:01:06 +00:00
2023-01-19 15:37:55 +00:00
let list_of_chars str =
List.init (String.length str) (String.get str)
;;
let rec transpose = function
| []
| [] :: _ -> []
| rows -> List.map List.hd rows :: transpose (List.map List.tl rows)
;;