In TEAPOT, each value has an associated data type. The following
data types exist:
- Empty
- Empty cells behave as if they have 0, 0.0 or “” as
value, depending on context. However, the specific unique “empty”
value can be tested for explicitly, distinct from any of these, for
example with is(loc, empty).
- String
- A string is a sequence of characters enclosed by double
quotes: This is a string. A
double quote can be part of the string, if it is quoted using a backslash:
“\””. If you want the backslash to
appear in the output instead of quoting the next character, use it
to quote itself: “\\”.
- Floating Point
- Floating point values are inexact, their precision
and range depends on the implementation of the C type long double
on your system. An example is: 42.0
- Integer
- Integer values are exact, their range depends on the
C type long long on your system. An example is: 42
- Boolean
- “true” or “false,” used for logical conditions.
- Label
- Cell labels are of this type, but they generally evaluate
to locations (or cause an error if there is no cell with that label),
so you don't generally manipulate values of this type.
- Keyword
- The names of functions and of special arguments to functions,
like the decimal flag to the float() function.
- Location
- The values of cell labels and the result of the &()
function have this type, but there are no location constant literals.
However, &(3,2,1), for example, acts very much
like a location constant literal.
- Error
- Syntactical or semantical (type mismatch) errors cause
this value, as well as division by 0 and the function error().
An error always has an assigned error message. Functions and operators,
when applied to a value of the type error, evaluate to just that value.
That way, the first error encountered, possibly deep inside a complicated
expression, will be shown.
- Expression
- a TEAPOT formula; some functions (like find())
take an expression as an argument so that it can be evaluated from
the point of view of other cells.
- Style
- the encapsulated visual/display attributes of a cell. Not
many operators/functions apply to Style values, but there is one function
for each attribute of a Style (that produces Style values with that
attribute set), and they may be combined with the + operator. Style
expressions are the key to allowing the appearance of a cell to depend
on its value.