remove unnecessary exception match
This commit is contained in:
parent
c6ba203526
commit
da551ffe25
1 changed files with 2 additions and 3 deletions
5
day4.ml
5
day4.ml
|
@ -105,9 +105,8 @@ module Validators = struct
|
|||
|
||||
let year_range lo hi x =
|
||||
x =~? {|^\d{4}$|} &&
|
||||
match int_of_string x with
|
||||
| exception Invalid_argument _ -> false
|
||||
| x -> x >= lo && x <= hi
|
||||
let x = int_of_string x in
|
||||
x >= lo && x <= hi
|
||||
|
||||
let%test _ = year_range 1900 2000 "1950"
|
||||
let%test _ = year_range 1900 2000 "1900"
|
||||
|
|
Loading…
Add table
Reference in a new issue