free.spad line 1 [edit on github]
This internal package represents monoid (abelian or not, with or without inverses) as lists and provides some common operations to the various flavors of monoids.
leftMult(s, a) returns s * a where * is the monoid operation, which is assumed non-commutative.
listOfMonoms(l) returns the list of the monomials forming l.
makeMulti(l) returns the element whose list of monomials is l.
makeTerm(s, e) returns the monomial s exponentiated by e (e.g. s^e or e * s).
makeUnit() returns the unit element of the monomial.
mapExpon(f, a1^e1 ... an^en) returns a1^f(e1) ... an^f(en).
mapGen(f, a1^e1 ... an^en) returns f(a1)^e1 ... f(an)^en.
nthExpon(l, n) returns the exponent of the n^th monomial of l.
nthFactor(l, n) returns the factor of the n^th monomial of l.
outputForm(l, fop, fexp, unit) converts the monoid element represented by l to an OutputForm. Argument unit is the output form for the unit of the monoid (e.g. 0 or 1), fop(a, b) is the output form for the monoid operation applied to a and b (e.g. a + b, a * b, ab), and fexp(a, n) is the output form for the exponentiation operation applied to a and n (e.g. n a, n * a, a ^ n, a^n).
reverse(l) reverses the list of monomials forming l. This has some effect if the monoid is non-abelian, i.e. reverse(a1^e1 ... an^en) = an^en ... a1^e1 which is different.
reverse!(l) reverses the list of monomials forming l, destroying the element l.
rightMult(a, s) returns a * s where * is the monoid operation, which is assumed non-commutative.
size(l) returns the number of monomials forming l.