I am trying to write a recursive function that takes in a list as argument and returns the number of even and odd numbers in tuple (number_of_even, number_of_odd)
let rec countEvenOdd lst e o = match lst with | [] -> (e,o) (* Base case: empty list *) | hd :: tl -> if hd mod 2 = 0 then countEvenOdd tl (e + 1) o else countEvenOdd tl e (o + 1);;countEvenOdd [2;4;5;6;7;8];;
This just gives me the type:
- : int -> int -> int * int = <fun>