Timeline for Prevent an expression from evaluating a certain way (pattern-matching?)
Current License: CC BY-SA 4.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 30, 2019 at 22:02 | comment | added | Mr.Wizard | @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. | |
| Dec 30, 2019 at 17:28 | vote | accept | Tanner Legvold | ||
| Dec 30, 2019 at 17:28 | comment | added | Tanner Legvold | 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. | |
| Dec 30, 2019 at 14:35 | history | answered | Mr.Wizard | CC BY-SA 4.0 |