Given the system operator TensorContract I can define a new one, TensorContractLazy with the attribute HoldAll, which does some some optimizations, but whose definition still depends on the original System`TensorContract for some cases.
If I load old programs, however, they will not benefit from this because they do not use TensorContractLazy. I would like, if possible, in the current namespace, a way for my function, TensorContractLazy, to be called instead of System`TensorContract when evaluating TensorContract. This would allow old programs to be run with this new definition without changing them. However. I'm not sure if this is possible, or how it could be done.
Blockthe codes likeBlock[{TensorContract= TensorContractLazy},codes]– Lacia Oct 06 '22 at 13:57Moduleworks better thanBlockhere becauseModuledoes not replace the originalTensorContractused in the definition ofTensorContractLazy. However, it would be nice to be able to execute the old codes withTensorContractLazy, and without having to surround them with aModule. – user3257842 Oct 06 '22 at 14:05