I like Haskell's solution: custom defined operators with 10 available precedence levels (I forget exactly, but I remember 10) with the "standard" ones spaced out along it.
Posted Dec 7, 2012 9:39 UTC (Fri) by ekj (guest, #1524)
[Link]
Isn't that terribly hard to read ?
How do you know what will happen with:
a + b [custom] c * d
Means:
(a+b) [custom] (c * d)
Or:
((a+b) [custom] c) * d
Or:
a + (b [custom] c) * d
It's a mistake to ignore the customer
Posted Dec 7, 2012 16:18 UTC (Fri) by mathstuf (subscriber, #69389)
[Link]
Generally, the operators don't work just on numbers and so they don't mix much with the common ones much. Its to establish order within a class of operators (e.g., within the monad operators, arrow operators, and so on). If mathematical expressions tend to get passed in to them, make them lower precedence, otherwise you can play with the higher ones.