I am very new to OCaml and I am currently trying to solve some exercises. While doing so I stumbled over the following problem:
let compose_pair (p:(('b -> 'c) * ('a -> 'b))) : 'a -> 'c =
The goal is to complete the function such that it composes the two functions of the pair in sequence.
My problem is that, as far as I understand, the return type of this function should again be a function and I don't really know how to achieve that.
My attempt would be something like
(fst p) (snd p)
which happens to just return something of type 'c
if I understood this right.
Does anyone know how to solve this? i would be very thankful for some tips or hints.
My current try is this:
let compose_pair (p:(('b -> 'c) * ('a -> 'b))) : 'a -> 'c = fun x -> fst p (snd p x)