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.

Required fields*

2
  • 1
    $\begingroup$ You could use $ConditionHold here: Hold[ b, a + b ] /. key_ :> RuleCondition[ Lookup[ code, key, None, $ConditionHold ], KeyExistsQ[ code, key ] ] $\endgroup$ Commented Sep 3, 2024 at 13:55
  • 1
    $\begingroup$ Note that you'll probably want Unevaluated[key] instead of key on the rhs to avoid evaluation leaks. $\endgroup$ Commented Sep 3, 2024 at 13:58