Skip to main content
Post Closed as "Duplicate" by Carl Woll, Henrik Schumacher, rhermans, MarcoB, halirutan
Fix unicode
Source Link
Carl Woll
  • 131.7k
  • 6
  • 246
  • 359

How can I change the default grouping on an operator without a built-in meaning?

I've created my own infix operator by defining LeftArrow.

SetAttributes[LeftArrow, {NumericFunction, OneIdentity}]
ex1_ \[LeftArrow] ex2_ := ex1 /. Rule[ex2[[1]], ex2[[2]]]

(I'm using the Esc<-Esc form of LeftArrow in the second line, but I'm not sure how to get it to cut and paste...)(I'm using the Esc<-Esc form of LeftArrow in the second line)

When I use it, I need to string together applications like so:

eqIld2 = (((((((eqIld \[LeftArrow] eqVrx) \[LeftArrow] eqVct) \[LeftArrow] eqIcr) \[LeftArrow] eqVct) \[LeftArrow] eqIcl) \[LeftArrow] eqVtx) \[LeftArrow] eqIin)

I'd like to be able to avoid all the parentheses, and to get the same result for the same input with the parentheses removed.

I don't see the default grouping for LeftArrow documented anywhere. I've tried playing with various Attributes, but I can't find one that does what I want. It looks like there's an InfixNotation that accepts options, but they aren't documented.

What's the trick?

How can I change the default grouping on an operator without a built-in meaning?

I've created my own infix operator by defining LeftArrow.

SetAttributes[LeftArrow, {NumericFunction, OneIdentity}]
ex1_ \[LeftArrow] ex2_ := ex1 /. Rule[ex2[[1]], ex2[[2]]]

(I'm using the Esc<-Esc form of LeftArrow in the second line, but I'm not sure how to get it to cut and paste...)

When I use it, I need to string together applications like so:

eqIld2 = (((((((eqIld \[LeftArrow] eqVrx) \[LeftArrow] eqVct) \[LeftArrow] eqIcr) \[LeftArrow] eqVct) \[LeftArrow] eqIcl) \[LeftArrow] eqVtx) \[LeftArrow] eqIin)

I'd like to be able to avoid all the parentheses, and to get the same result for the same input with the parentheses removed.

I don't see the default grouping for LeftArrow documented anywhere. I've tried playing with various Attributes, but I can't find one that does what I want. It looks like there's an InfixNotation that accepts options, but they aren't documented.

What's the trick?

How can I change the default grouping on an operator without a built-in meaning?

I've created my own infix operator by defining LeftArrow.

SetAttributes[LeftArrow, {NumericFunction, OneIdentity}]
ex1_  ex2_ := ex1 /. Rule[ex2[[1]], ex2[[2]]]

(I'm using the Esc<-Esc form of LeftArrow in the second line)

When I use it, I need to string together applications like so:

eqIld2 = (((((((eqIld  eqVrx)  eqVct)  eqIcr)  eqVct)  eqIcl)  eqVtx)  eqIin)

I'd like to be able to avoid all the parentheses, and to get the same result for the same input with the parentheses removed.

I don't see the default grouping for LeftArrow documented anywhere. I've tried playing with various Attributes, but I can't find one that does what I want. It looks like there's an InfixNotation that accepts options, but they aren't documented.

What's the trick?

Source Link
Omegaman
  • 279
  • 1
  • 4

Changing the grouping of an user defined infix operator

How can I change the default grouping on an operator without a built-in meaning?

I've created my own infix operator by defining LeftArrow.

SetAttributes[LeftArrow, {NumericFunction, OneIdentity}]
ex1_ \[LeftArrow] ex2_ := ex1 /. Rule[ex2[[1]], ex2[[2]]]

(I'm using the Esc<-Esc form of LeftArrow in the second line, but I'm not sure how to get it to cut and paste...)

When I use it, I need to string together applications like so:

eqIld2 = (((((((eqIld \[LeftArrow] eqVrx) \[LeftArrow] eqVct) \[LeftArrow] eqIcr) \[LeftArrow] eqVct) \[LeftArrow] eqIcl) \[LeftArrow] eqVtx) \[LeftArrow] eqIin)

I'd like to be able to avoid all the parentheses, and to get the same result for the same input with the parentheses removed.

I don't see the default grouping for LeftArrow documented anywhere. I've tried playing with various Attributes, but I can't find one that does what I want. It looks like there's an InfixNotation that accepts options, but they aren't documented.

What's the trick?