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
How about
ops = {LessEqual, GreaterEqual};
ineqRules = (HoldPattern[Inequality[a_, #, c_, _, e_]] :> a == c) & /@ ops
Edit: To fix the problem noted in belisarius's answer, try:
ineqRules=Flatten[{HoldPattern[Inequality[a_,#,c_,___]]:>a==c,HoldPattern[#[a_,c_]&&___]:>a==c}&/@ops]
This obviously depends on you having a simple structure to begin with, i.e. no other &&'s.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With