Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • $\begingroup$ Thanks @Mr.Wizard this was the solution I was looking for. But I ran into some strange behavior that I described more in an edit to the original question (it took a lot of space) that I'm sure you know the explanation for. $\endgroup$ Commented Dec 30, 2019 at 17:28
  • $\begingroup$ @Tanner Two points. (1) a_.b_ c_ is NOT the same as a_ . b_ c_ because a_. parses as Optional[Pattern[a, _]]. Perhaps I should have written Dot[a_, b_] c_ for robustness. (2) The second definition of $Pre is itself modified by the existing Function; here is a stand-alone example: Function[, Unevaluated[#] /. Dot[a_, b_] c_ :> a.(b c), HoldAll] /. Dot[a_, b_] c_ :> a.(b c) — within the result the left hand side of RuleDelayed is transformed into (a_).(b_ c_) which is the new precedence rather than the original one. $\endgroup$ Commented Dec 30, 2019 at 22:02