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.

13
  • $\begingroup$ That's a start, thanks. I guess I'd like to transform/execute the pattern at match-time, not at define-time; but the idea is there in your solution. $\endgroup$ Commented Mar 29, 2019 at 6:20
  • $\begingroup$ @Roman With pleasure. If there are more ‘elegant’ approaches, please let me know. $\endgroup$ Commented Mar 29, 2019 at 11:13
  • $\begingroup$ I've adopted your solution for the linked problem at mathematica.stackexchange.com/a/194103 $\endgroup$ Commented Mar 29, 2019 at 11:18
  • $\begingroup$ I know it's not what you are looking for, but pattern := Through[(Identity | h)[f]] doesn't transform at definition time. $\endgroup$ Commented Mar 31, 2019 at 11:14
  • $\begingroup$ That's right @mikado, but as soon as I use the pattern in a non-delayed setting it gets evaluated right away. For example, define Q[x : Through[(Identity | h)[f]]] = x and then check ?Q: you see that the definition of Q contains the evaluated alternative pattern f|h[f]. $\endgroup$ Commented Mar 31, 2019 at 17:11