Alternatively:
expr /.
foo_f :> RuleCondition[Hold[foo] /. Print -> Echo] /.
Hold[foo_f] :> foo
We can safely perform the second replacement because we just wrapped every f[..]
with Hold
.
Alternatively:
expr /.
foo_f :> RuleCondition[Hold[foo] /. Print -> Echo] /.
Hold[foo_f] :> foo
We can safely perform the second replacement because we just wrapped every f[..]
with Hold
.