Axiom variables are a class of eXPL artifacts for initializing, populating and accessing dynamic lists. They expand the possibilites for both query inputs and outputs, as the following examples will show.
Dynamic Axioms
A dynamic list can be declared with no initial content and populated by appending dynamic axioms using the concatenation += operator.
An example of this is in Birds of tutorial7, which works with bird classification data to generate a list of birds of
the order "waterfowl". This is the declaration of dynamic list named "waterfowl" which is exported and initially empty:
This is the dynamic axiom also named "waterfowl":
The waterfowl axiom is constructed with three terms. The "bird" and "voice" terms are set by unification with the "species" axion collection, while the "feet" term is set from the "order" axiom collection. The solution displayed on the console is:
bird=trumpeter swan, voice=loud trumpeting, feet=webbed
bird=snow goose, voice=honks, feet=webbed
bird=pintail, voice=short whistle, feet=webbed
A dynamic axiom term can be defined as one of several things:
- Identifier - for untyped variable
- Type + identifier - for typed variable
- Identifier + list operator(s) - for list variable
- Literal - for anonymous literal term
A variable can optionally be assigned to an expression to initialize it.
Dynamic List Initialization
The dynamic list declaration can specify how the list is to be populated in a one-time initialization to occur on the first time the list is evaluated. The specification consists of an optional axiom name, followed by a sequence of one or more dynamic axioms, to which a list of parameters can be optionally appended. Application Gaming in tutorial7 demonstrates a dynamic list input into a query to play one turn of a fruity poker machine. The play is framed as a 3 x 4 matrix built from a dynamic list. Unpredictability is provided by generating random numbers as dynamic list parameters. This is the list declaration:
{ c1=0^r2, c2=1^r2, c3=2^r2, c4=3^r2 }
{ c1=2^r3, c2=1^r3, c3=3^r3, c4=0^r3 }
(
integer r1 = system.random(4),
integer r2 = system.random(4),
integer r3 = system.random(4)
);
