2.8 Data types and assignments
The previous five sections describe the five data types used by BayES:
-
matrices
-
datasets
-
models
-
structures
-
strings
When using assignment statements, BayES infers the type of the item defined from the right-hand side expression. For example, the statement:
defines a string with id value s and assigns the value "Hello from BayES!" to it. The user does not have to declare s as a string before assigning a value to it: BayES infers that s is a string because the right-hand side expression, "Hello from BayES!", is a string. All functions that operate on strings can be used on s.
Suppose that a subsequent statement in the same script is:
This statement redefines s as a vector and all functions that operate on matrices can be used with s. Furthermore, BayES deletes the value that s had when it was a string from memory without issuing any error or warning. This means that the same id value can be used in a script to represent different data types at different points. At every point, however, an id value can be associated with a single data type and previous definitions are cleared from memory.