Refactored the entire code.

This commit is contained in:
2025-11-26 23:36:52 +03:00
parent 4709e81b81
commit 684d584402
3 changed files with 122 additions and 90 deletions

View File

@@ -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