removed some leftover useless code

This commit is contained in:
2024-12-05 22:45:11 +01:00
parent 7c9a40aaba
commit 83f8326ccb

View File

@@ -19,50 +19,6 @@ let file_to_2d_array in_file =
List.iteri (fun j line -> String.iteri (fun i c -> arr.(j).(i) <- c) line) lines;
arr
let rec parse_int_list str =
let list1 = (List.filter (fun a -> length a != 0) (String.split_on_char ' ' str)) in
List.map int_of_string list1
let rec int_list_diff int_list =
match int_list with
| e1 :: e2 :: tail -> e2 - e1 :: int_list_diff (e2 :: tail)
| _ -> []
let list_diffs_safe diff_list =
match diff_list with
| n :: tail ->
if n > 0 then
List.for_all (fun x -> x >= 1 && x <= 3) diff_list
else if n < 0 then
List.for_all (fun x -> x >= -3 && x <= -1) diff_list
else
false
| _ -> true
let rec list_diff_safe_with_tolerance_inner last condition tol diff_list =
match diff_list with
| x :: tail ->
if condition x then
list_diff_safe_with_tolerance_inner x condition tol tail
else if tol then
match tail with
| x2 :: tail2 ->
list_diff_safe_with_tolerance_inner 0 condition false (x + x2 :: tail2)
|| list_diff_safe_with_tolerance_inner 0 condition false (last + x :: tail)
| _ -> true
else
false
| _ -> true
let list_diff_safe_with_tolerance diff_list =
if list_diff_safe_with_tolerance_inner 0 (fun x -> x >= 1 && x <= 3) true diff_list
|| list_diff_safe_with_tolerance_inner 0 (fun x -> x >= -3 && x <= -1) true diff_list then
true
else
match diff_list with
| _ :: tail -> list_diffs_safe tail
| _ -> true
let rec count_in_string_inner re str pos acc =
try
let new_pos = Str.search_forward re str pos in