factor out memoization code from SharedTerm operations
factor out memoization code from SharedTerm operations

GaloisInc/saw-script,GaloisInc/saw-script,GaloisInc/saw-script,GaloisInc/saw-script,GaloisInc/saw-script