Refactoring, errors are not thrown anymore

This commit is contained in:
elvis
2024-10-26 01:47:30 +02:00
parent 8427133fd7
commit 3e4e1615d2
11 changed files with 413 additions and 339 deletions

View File

@ -11,7 +11,7 @@ let program =
)
;;
Printf.printf "Identity program: %d\n" (reduce program 1)
Printf.printf "Identity program: %d\n" (Result.get_ok (reduce program 1))
(* -------------------------------------------------------------------------- *)
(* Constant program *)
@ -23,7 +23,7 @@ let program =
)
;;
Printf.printf "Constant program: %d\n" (reduce program 10)
Printf.printf "Constant program: %d\n" (Result.get_ok (reduce program 10))
(* -------------------------------------------------------------------------- *)
(* Partial application of function program *)
@ -37,7 +37,7 @@ let program =
)
;;
Printf.printf "Partial application of function program: %d\n" (reduce program 2)
Printf.printf "Partial application of function program: %d\n" (Result.get_ok (reduce program 2))
(* -------------------------------------------------------------------------- *)
(* Partial application of function program *)
@ -53,7 +53,7 @@ let program =
)
;;
Printf.printf "Partial application of function program: %d\n" (reduce program 3)
Printf.printf "Partial application of function program: %d\n" (Result.get_ok (reduce program 3))
(* -------------------------------------------------------------------------- *)
(* Passing functions to functions program *)
@ -89,8 +89,8 @@ let program =
)
;;
Printf.printf "Passing functions to functions program 1: %d\n" (reduce program (3));
Printf.printf "Passing functions to functions program 2: %d\n" (reduce program (-3))
Printf.printf "Passing functions to functions program 1: %d\n" (Result.get_ok (reduce program (3)));
Printf.printf "Passing functions to functions program 2: %d\n" (Result.get_ok (reduce program (-3)))
(* -------------------------------------------------------------------------- *)
(* Recursive function program *)
@ -104,7 +104,7 @@ let program =
)
;;
Printf.printf "Recursive function program: %d\n" (reduce program 10)
Printf.printf "Recursive function program: %d\n" (Result.get_ok (reduce program 10))
(* -------------------------------------------------------------------------- *)
(* Scope program *)
@ -116,7 +116,7 @@ let program =
)
;;
Printf.printf "Scope program: %d\n" (reduce program 4)
Printf.printf "Scope program: %d\n" (Result.get_ok (reduce program 4))
(* -------------------------------------------------------------------------- *)
(* Factorial program *)
@ -130,7 +130,7 @@ let program =
)
;;
Printf.printf "Factorial program: %d\n" (reduce program 10)
Printf.printf "Factorial program: %d\n" (Result.get_ok (reduce program 10))
;;
(* -------------------------------------------------------------------------- *)
@ -154,7 +154,7 @@ let program =
)
;;
Printf.printf "Hailstone sequence's lenght program: %d\n" (reduce program 77031)
Printf.printf "Hailstone sequence's lenght program: %d\n" (Result.get_ok (reduce program 77031))
;;
(* -------------------------------------------------------------------------- *)
@ -176,7 +176,7 @@ let program =
)
;;
Printf.printf "Sum multiples of 3 and 5 program: %d\n" (reduce program 12345)
Printf.printf "Sum multiples of 3 and 5 program: %d\n" (Result.get_ok (reduce program 12345))
;;
(* -------------------------------------------------------------------------- *)
@ -190,7 +190,7 @@ let program =
;;
Printf.printf "Rand program: %b\n" ((reduce program 10) < 10)
Printf.printf "Rand program: %b\n" ((Result.get_ok (reduce program 10) < 10))
;;
(* -------------------------------------------------------------------------- *)
@ -213,5 +213,5 @@ let program =
;;
Printf.printf "Fibonacci program: %d\n" (reduce program 48)
Printf.printf "Fibonacci program: %d\n" (Result.get_ok (reduce program 48))
;;