Link Search Menu Expand Document

Composite values

Conceptually, composite values are constructed from sequences of argument values. The types of composite values include parametrised algebraic data types, with a generic representation. Various algebraic datatypes are defined, and new ones can be introduced. Composite values include also built-in parametrised types of sets, maps, multi-sets, and graphs.

A composite value can always be decomposed into a sequence of values from which it can be reconstructed. For algebraic datatypes such as lists, the decomposition is unique. For a built-in type such as sets, the funcon provided to compute values is not a constructor. and it may compute the same composite value from different sequences of arguments. All composite ground values can be tested for equality.

The CBS library includes types of composite values corresponding to the following concepts:

Algebraic datatypes

Algebraic datatypes correspond to unions of subtypes, The values of each subtype generally consist of a fixed constructor identifier together with different sequences of argument values. The constructors can be declared separately from the types of their values, supporting GADTs.

grouped sequences of values
grouped sequences of values with the usual operations (strings are lists of characters)
grouped sequences of values
finitely branching, with values at branch points
values that represent other values (pointers are references or pointer-null)
unordered indexed aggregate values
values tagged by identifiers
collections of features, allowing multiple superclasses, with abstractions to create objects
classified collections of features
including bits and bytes

Other types

The following types of composite values are all built-in. The funcons used to compute such values are not regarded as constructors, as they are not injective.

unordered, unindexed collections of values
unordered, indexed collections of values
unordered, unindexed collections of values with multiplicities (bags)
directed, possibly cyclic, graphs

Table of contents