Here is code in the clan pattern. The value new-seal can be found here. Perhaps better here.

Since this implementation of new-seal is very inefficient, this package is also very inefficient. The clan code itself is inefficient for many use cases—it is to illustrate abstraction. With an efficient primitive new-seal a small modification to this set manipulation code would be efficient and also able to enforce abstraction and thus guarantee its inner logic.

Each invocation of slg returns a new clan of values. Two clans are incompatible. A clan is provided as a list of values:

The routine l->S takes the yield of slg and returns a routine to transform abstracted values to ordinary sorted lists. The routine S->l takes such a yield and returns a routine to convert an ordinary (not necessarily sorted) list into the abstracted version.

This code guards against corruption of its internal data structures.