EDITED: Alright, this is the complete error :
45 | | _ -> Z.of_int 3 * Z.(s1 (num-1)) + Z.(sum_s1 num)
^^^^^^^^^^
Error: This expression has type Z.t but an expression was expected of type
int
And this is the code in question :
let rec s1 num =
match num with
| 0 -> Z.of_int(1)
| 1 -> Z.of_int(2)
| _ -> Z.of_int 3 * Z.(s1 (num-1)) + Z.(sum_s1 num)
and
sum_s1 num =
let rec sum_s1_impl (num, k) =
if (num-2 < 1) || (k > num-2) then 0
else (s1 k) * (s1 (num-k-1)) + (sum_s1_impl (num, k+1))
in sum_s1_impl (num, 1);;
I don't know where is the problem/how can I fix it (some tips)
Thanks!!
EDIT#2 :
let rec s1 num =
match num with
| 0 -> Z.of_int(1)
| 1 -> Z.of_int(2)
| _ -> Z.of_int(3 * (s1 (num-1)) + (sum_s1 num))
and
sum_s1 num =
let rec sum_s1_impl (num, k) =
if (num-2 < 1) || (k > num-2) then 0
else (s1 k) * (s1 (num-k-1)) + (sum_s1_impl (num, k+1))
in sum_s1_impl (num, 1);;
Even with the use of Z.of_int(3 * (s1 (num-1)) + (sum_s1 num))
I stil get the same error