A compactification of the algebra of terms