Timeline for How to make a pattern that matches only when one of the argument's Head is a Plus?
Current License: CC BY-SA 4.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 16, 2022 at 3:11 | vote | accept | user13892 | ||
| May 16, 2022 at 0:51 | comment | added | lericr | I think that’s a matter of style | |
| May 16, 2022 at 0:40 | comment | added | user13892 | My other question was if there was a need for both cases CircleTimes[x_Plus,y_] and CircleTimes[x_,y_Plus] to be present, is there a better way then CircleTimes[x_,y_]/;MemberQ[{Head@x,Head@y},Plus] to combine them. | |
| May 16, 2022 at 0:38 | comment | added | user13892 | Thank you my issue was the CircleTimes[x,y] blowing up inside the Distribute causing infinite recursion. Also CircleTimes[x_,y_]:=-CircleTimes[y,x] removes the need for both CircleTimes[x_Plus,y_] and CircleTimes[x_,y_Plus] definitions to be defined and same for the Times case. Everything works fine now! | |
| May 15, 2022 at 23:56 | history | answered | lericr | CC BY-SA 4.0 |