I wrote the following function in Ocaml that gets nested Pair and return Pair(a,b) so that a is a nested Pair of all the odd elements and b is a nested Pair with all the eve