z = combine(x,y,f,g,h) or z=combine(x,y,f,t,g,h)
The function h should be an associative function, for otherwise the result may depend on internal details about the implementation of hash tables that affect the order in which entries are encountered. If f, t (if present), g, and h are commutative functions as well, then the result z is a commutative function of x and y.
The result is mutable if and only if x or y is.
This function can be used for multiplying polynomials, where it can be used in code something like this:
combine(x, y, monomialTimes, coeffTimes, coeffPlus)We illustrate that with a simpleminded implementation of the free ring on the English alphabet, representing words as string and polynomials as hash tables that associate coefficients to words.




combine(x, y, monomialTimes, divPowCoeff, coeffTimes, coeffPlus)For example:





The object combine is a compiled function.