Cache terms before free variables are gathered
Cache terms before free variables are gathered

A tensor could hardly be used just for the sake of getting its free
variables.  So we need to cache the result before gathering the free
variables, so that the terms will not be computed again when we actually
need them.

tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge