Relision has hit version 0.6.0, meaning that collections are implemented. The collections model for Relision is pretty much the same as it was for Elision, with a few tweaks.
A Relision collection is just a collection of terms, along with some algebraic properties. The properties are the following.
- Associativity – grouping doesn’t matter; flatten
- Commutativity – order doesn’t matter; sort
- Idempotency – repeated elements aren’t allowed; discard them
- Identity – identity doesn’t change meaning; discard if possible
- Absorber – absorber collapses collection; discard everything else
- Element – all elements must match this type
- Guard – the guard must be TRUE for all elements
These are all specified with a relatively cryptic (but compact) form just before the collection of terms. It is surprisingly generic. Want a set? That’s commutative and idempotent. Want a bag? That’s commutative but not idempotent. Want a list? That’s not commutative.
The Relision collection actually does a lot of work for you. If the collection is commutative, then Relision sorts it on creation. If it is idempotent, it eliminates repeated elements. If a collection includes the identity, it is discarded (assuming other elements remain). If there is an absorber, everything else is discarded.
Collections are a necessary step on the way to operators, since collections are used to specify the operator’s parameter and argument lists.