`commassop(``operatorname`

)

The returned procedure first sorts its operands (which it may
do because of commutativity). Those operands not belonging to a domain
of category `Cat::Set`

are handled by the usual overloading
mechanism, i.e. by the slot `operatorname`

of one
of their domains. Out of the others, several operands belonging to
the same domain are handled by the slot `"homog".operatorname`

of
that domain. Finally, the returned method tries to combine each possible
pair of operands. If they are from the same domain, `"bin".operatorname`

is
called for them. The following is done if the operands are from different
domains: let `T1`

and `T2`

be their
types; then their `"inhomog".operatorname`

slots
are used. If such a slot exists in the domain `T1`

,
it must contain a table indexed by possible types `T2`

,
and the entry at that index must be a procedure that carries out the
operation for exactly two arguments, the first being a `T1`

,
the second being a `T2`

. Conversely, if such a slot
exists in the domain `T2`

, it must contain a table
indexed by possible types `T1`

, and the entry at
that index must be a procedure that carries out the operation for
exactly two arguments, the first being a `T2`

, the
second being a `T1`

.

The slot `"homog".operatorname`

, or a table
entry in the slot `"inhomog".operatorname`

, may return `FAIL`

in
order to indicate that it could not simplify its input; if they are
missing, this indicates that a simplification is generally not possible
for input of this type. In these cases, the returned procedure proceeds
by trying to combine another two of the given arguments.

A slot `"bin".operatorname`

usually won't exist,
except for the case that there is no `"homog".operatorname`

;
usually the latter can also take care for the case of exactly two
operands.

The whole process is repeated over and over until no new simplifications
occur or only one operand is left. If no more simplifications occur,
an unevaluated call to the operator is returned, the arguments being
all remaining operands that could not be combined further.

`binop(``operatorname`

)

The returned procedure uses the slot `"bin".operatorname`

of
its first argument if both arguments are of the same type. Otherwise
it uses the slot `"inhomogleft".operatorname`

of
its first argument; if that fails, it uses the slot `"inhomogright".operatorname`

of
its second argument; each of these slots, if it exists, must contain
tables, indexed by the type of the other argument, such that ```
slot(T1,
"inhomogleft".operatorname)[T2]
```

and `slot(T2, "inhomogright".operatorname)[T1]`

carry
out the operation for objects of type `T1`

and `T2`

,
in this order.

No commutativity of the operation is assumed.

If the slots or table entries do not exist or return `FAIL`

,
an unevaluated call to the operator is returned.

`_plus(``S`_{1}, …

)

The sum of sets is computed by the commutative-associative operator
generated by `"commassop"`

, using the slots `"homog_plus"`

and `"inhomog_plus"`

of
the domains of its operands.

`_mult(``S`_{1}, …

)

The product of sets is computed by the commutative-associative
operator generated by `"commassop"`

, using the slots `"homog_mult"`

and `"inhomog_mult`

of
the domains of its operands.

`_power(``S`_{1}

, `S`_{2}

)

The power of sets is computed by the binary operator generated
by `"binop"`

, using the slots `"homog_power"`

, `"inhomogleft_power"`

,
and `"inhomogright_power"`

of its operands.

`map(``S`

, `f`

)

By overloading this method in a particular domain, the behavior
of sets changes whenever a special function is applied to them.