let (++) fgx = f (gx) in let fx = x + 1 in let gx = x * 2 in (f++g) 1;;
f++gx = 2 * x + 1
Your implementation of function composition is correct because:
(g ∘ f) (x) = g (f (x)) for all x in X
according to wikipedia
I get:
- : int = 3
at ocamlktop