# collection type operation

Collection type operations support assignment, logical and arithmetical operations. Comparison operations are not supported. The result of a set operation is always a collection.

Both operands of a set operation must refer to collections (array or reference collection). When this is not the case, the set operation returns an empty collection.

Set operations can be performed based on object identity, but also based on values. A set operation based on object identities considers elements as identical, when they have the same object identity. This principle does not work for array instances, which do not have object identities.

A value based set operation considers two elements as identical, when they have the same value. The value of an instance is based on a value function defined for each instance. A typical value function is the key value function, which can be defined as key for each complex data type.

Logical operations are supported as "and" operation, which corresponds to the intersect operation, and as "or" operation, which corresponds to the union operation. The "xor" operation (a xor b) corresponds to ( (a or b) - (a and b) ).

Arithmetical operations are supported as '+', which corresponds to union, '*', which corresponds to product and '-' which corresponds to minus set operation. All other operations will return an empty collection.