]>
Pierre Weis writes:
| In fact we discourage the usage of functional composition as a general
| programming tool
A very bad idea, in my opinion.
| -- it only save a few characters in programs
| (Compare
| let h = f o g
| with
| let h x = f (g x);;)
| -- it breaks the polymorphism
| (if defined as
| let h = f o g
| h is not generalized, since its definition is a function
| application, whereas inline expansion of functional composition
| let h x = f (g x)
| being the definition of a function is properly generalized.)
These alternatives are not semantically equivalent. If f and g are
complicated expressions that can be further evaluated, it is often
highly undesirable to perform the evaluation every time h is called,
which is what "let h x = f(g x)" entails.
John.