Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.8K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Precedence for Undefined Operator

Posted 11 years ago

Is it possible to assign a Precedence for an operator that has no defined meaning? Here is an example. I am using CircleTimes and LeftRightArrow. I rather like LeftRightArrow because it represents a symmetrical product and rather looks like that. But I would like to have LeftRightArrow have a higher precedence than CircleTimes.

Attributes[LeftRightArrow] = {Orderless};

The following uses the Tilde notation and (somewhat surprisingly) gives what I want. However I don't want to use the heavier Tilde notation.

LeftRightArrow[w,x] ~ LeftRightArrow ~ LeftRightArrow[y,z] ~ CircleTimes ~ s

Rather, I would be entering the expression using a palette so the expression would look like this:

(v\[LeftRightArrow]u)\[LeftRightArrow](t\[LeftRightArrow]s)\[CircleTimes]a

And that uses the higher precedence of CircleTImes. I know I could add an extra set of parentheses but I would prefer to have a simple way to assign the precedence to LeftRightArrow. (When I tried to use PrecedenceForm, my PasteButton didn't work correctly.)

The entire matter of user definition of precedence seems to be ill designed and extremely poorly documented. For operators that have no built in definition it should be allowable and easy to assign a Precedence - perhaps as an Attribute.

2 Replies

I have not tried it myself, but supposedly it can be done with the Notations package. See
http://reference.wolfram.com/language/Notation/tutorial/ComplexPatternsAndAdvancedFeatures.html

(This demonstrates your complaint that it is not easy.)

I did not find an existing formal suggestion on this. Please feel free to send one via http://www.wolfram.com/support/contact/email/?topic=Technical . The clearer and more specific the suggestion, the more likely to get developer interest.

POSTED BY: Bruce Miller
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard