[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
infix notation [Re: Macros and little languages]
> In technology, you've got to
> watch out for choosing custom over something that actually
> works better. That's why HP scientific calculators use
A side discussion (which I believe was
partly inspired by Arc) led me to find
the following mathematical argument for
infix notation; it may be more than a
simple matter of custom.
> A little hesitance was induced when my late colleague Wouter Peremans
> remarked in passing that infix notation was of course "a notational
> relic". It made me realize why I like it so much for associative
> operators: it allows us to write p+q+r without being forced to choose
> between (p+q)+r and p+(q+r); in prefix notation, the choice between
> ++pqr and +p+qr would have been unavoidable.
> [EWD249: Programming (or problem solving in general?) as the judicious
> postponement of decisions and commitments]
> The main reason to stick to the infix notation for the usual
> operators was, of course, that we all are so terribly used to it,
> but the associativity does play an honest role: I did introduce --
> with great satisfaction! -- infix operators for what I used to denote
> by max(x,y) and gcd(x,y), and find that I don't introduce anymore
> infix operators that are not associative.