User-Defined Operators, Re: Function composition and currying

Jon Fairbairn Jon.Fairbairn@cl.cam.ac.uk
Thu, 17 Jul 2003 16:46:13 +0100


On 2003-07-17 at 09:08+0200 Johannes Waldmann wrote:
> On Wed, 16 Jul 2003, K. Fritz Ruehr wrote:
> 
> > I think the cutest way to get what you want here is to define a new
>               ^^^^^^
> > operator as follows:
> > 
> >     (.<) = (.) . (.)
> 
> Indeed this is cute - but let me add a general comment here:
> in my code, I don't define any operators at all (only functions).
> I do think that self-defined operators make a programm less readable.

While I agree with that, I think that the language needs
"user"-defined operators for libraries; it's a matter of
defining them rarely and getting them widely accepted. I'm
even tempted to suggest that the language ought to restrict
their use to gurus.

Someone mentioned multiplying by a scalar. I think this is a
good application, but what we need is to agree (somehow) on
the symbol used. I've used (*.) and (.*), with the dot being
on the side the scalar is on (on the grounds that . is a
scalar product elsewhere), but without wide agreement I
agree that this sort of thing reduces readability, because
while I can read these programmes, it's harder for everyone
else.

 Jón


-- 
Jón Fairbairn                                 Jon.Fairbairn@cl.cam.ac.uk