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 =
|
let year_range lo hi x =
|
||||||
x =~? {|^\d{4}$|} &&
|
x =~? {|^\d{4}$|} &&
|
||||||
match int_of_string x with
|
let x = int_of_string x in
|
||||||
| exception Invalid_argument _ -> false
|
x >= lo && x <= hi
|
||||||
| x -> x >= lo && x <= hi
|
|
||||||
|
|
||||||
let%test _ = year_range 1900 2000 "1950"
|
let%test _ = year_range 1900 2000 "1950"
|
||||||
let%test _ = year_range 1900 2000 "1900"
|
let%test _ = year_range 1900 2000 "1900"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue