The conclusion is a bit unsatisfying. It considers only composition of objects and draws a distinction with procedure passing or lambdas. But in a functional language, composition of functions is a very easy and common thing to do. In Haskell, for example, you’d use the dot operator:
f = g . h
Now f is the composition of the functions g and h. More concretely:
The conclusion is a bit unsatisfying. It considers only composition of objects and draws a distinction with procedure passing or lambdas. But in a functional language, composition of functions is a very easy and common thing to do. In Haskell, for example, you’d use the dot operator:
f = g . hNow f is the composition of the functions g and h. More concretely:
g x = x + 1 h x = 3 * x f = g . h {- now f x = 3*x + 1 -}