I have two functions f and g and I am trying to return f(g(x)) but I do not know the value of x and I am not really sure how to go about this.
A more concrete example: if I have functions f = x + 1 and g = x * 2 and I am trying to return f(g(x)) I should get a function equal to (x*2) + 1
It looks like you have it right,
f(g(x))should work fine. I’m not sure why you have areturnkeyword there (it’s not a keyword in ocaml). Here is a correct version,The type definition for this is,
Each, ‘a,’b,’c are abstract types; we don’t care what they are, they just need to be consistent in the definition (so, the domain of
gmust be in the range off).