Re: Functional composition operator?

From: John Harrison (
Date: Tue Dec 08 1998 - 22:52:54 MET

Subject: Re: Functional composition operator?
Date: Tue, 08 Dec 1998 21:52:54 +0000
From: John Harrison <>
Message-Id: <>

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.


This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:17 MET