removed some leftover useless code
This commit is contained in:
44
4/main.ml
44
4/main.ml
@@ -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;
|
List.iteri (fun j line -> String.iteri (fun i c -> arr.(j).(i) <- c) line) lines;
|
||||||
arr
|
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 =
|
let rec count_in_string_inner re str pos acc =
|
||||||
try
|
try
|
||||||
let new_pos = Str.search_forward re str pos in
|
let new_pos = Str.search_forward re str pos in
|
||||||
|
Reference in New Issue
Block a user