rewrite shape layer

A shape consists of a subclass of BaseShapeFunc, which holds the
clump operators, and an instance of a subclass of BaseShapeType,
which defines the generalizations of the shape, the validator,
and an implicit reference to the corresponding BaseShapeFunc.

This new design is simpler, much more compact, and more amenable to a
future re-implementation in C.
make clump immutable

Clump is a fundamental datatype and will be exposed to several higher
layers. Therefore keeping it immutable will remove statefulness and
will simplify consistency checks.

The mutator methods of clump now return modified shallow copies.