将东西放入 HoldPattern 中
我正在生成这样的替换规则列表。
ops = {LessEqual, GreaterEqual}; ineqRules = Table[HoldPattern[Inequality[a_, op1, c_, _, e_]] -> a == c, {op1, ops}]
上面不起作用,因为“op1”被 HoldPattern 从表中隐藏,我该如何修复它?
这是上一个问题的后续问题
I'm generating a list of replacement rules like this
ops = {LessEqual, GreaterEqual}; ineqRules = Table[HoldPattern[Inequality[a_, op1, c_, _, e_]] -> a == c, {op1, ops}]
Above doesn't work because "op1" is hidden from Table by HoldPattern, how do I fix it?
This is a follow-up to previous question
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
编辑怎么样
:要解决贝利撒留的答案中指出的问题,请尝试:
这显然取决于您有一个简单的结构开始,即没有其他 && 的。
How about
Edit: To fix the problem noted in belisarius's answer, try:
This obviously depends on you having a simple structure to begin with, i.e. no other &&'s.
这是 With 的工作:
This is a job for With:
我确信应该有更好的方法,但这似乎有效:
HTH
Edit
请小心这一点:
但
我想如果需要的话,需要一些 Hold[] 野兽才能摆脱困境......让我们知道
I am sure there should be a better way, but this seems to work:
HTH
Edit
Be carefull with this:
But
I guess some Hold[] beast is needed to get out of that if needed ... let us know