[erlang-questions] Infix function and user-defined operators

empro2 <>
Sun Jan 20 19:59:56 CET 2019

> It's ironic that you mention C++, because C++ is *the*
> example of operator abuse.

Ironic? That is the reason why I mentioned it. I put the
"ab-" in brackets because I am too stupid to get anywhere
near a licence to mention naked mole rats. 

> The example of X^Y is an interesting one, because you
> don't, you really don't, want to go around writing
> exp(Y*log(X)) all the time.

math:pow(X, Y)? (Sorry, if I am being stupid.)

Speaking of it: I do not understand why there is no
math:log/2 ... but, lest there be any misunderstanding, I
do not want it as an infix fun! (or should I?)

> My own impression, and it is no more than that,
> is that infix operators help a lot when you are treating
> something as a quasi-algebraic expression that you are
> interested in rearranging and simplifying in a
> mathematical way.

But is that the operators in themselves or the being used to
them? Are there Lispers who do not have to "translate"
between "common" algebraic and Lisp phrasings (like I have
to)? or who even rearrange and simplify s-exps more easily
than ...?

To reverse the poles (how punny): some Forth people claim
that understanding Forth is an enlightening experience ...
(then again, sawing off ones foot might also be ;-)

When this thread came up, one of my first thoughts was:
why not stop _teaching_ any infix notation at all and
forget all these lexically invisible precedence and
associativeness rules? (I mitigated this heresy to that
question about "inherent superiority".)

> and even outright ambiguity. On the other hand, bulkier,
> clunkier, but more obvious syntax seems to work better
> for code that you want other people to read.

That could explain why coding style guides often suggest or
demand use of brackets instead of relying on operator rules.


“Even after a thousand explanations a fool is no wiser,
whereas someone intelligent requires only one fourth of

	– from the Mahābhārata (महाभारत)

More information about the erlang-questions mailing list