Refactored the entire code.
This commit is contained in:
@@ -31,6 +31,9 @@ let octal_reader (type a) (module I : IntType with type t = a) sin : a =
|
||||
let l = List.init (String.length s) (String.get s) in
|
||||
let rec aux a = function
|
||||
| c :: rest ->
|
||||
if (Char.code c) > (Char.code '7') || (Char.code c) < (Char.code '0') then
|
||||
I.of_int 0
|
||||
else
|
||||
aux ((a * (I.of_int 8)) + (I.of_int (int_of_char c)) - (I.of_int (int_of_char '0'))) rest
|
||||
| [] -> a
|
||||
in aux (I.of_int 0) l
|
||||
|
||||
Reference in New Issue
Block a user