Values overview
The values of CIF (and their types) can be categorized into different categories: elementary values, container values, and miscellaneous values. Elementary values represent single values, such as a single number. Container values represent multiple values. The different container values combine or store the values in different ways. The elementary and container values are described in the remainder of this part of the tutorial. The miscellaneous values are special, and are explained later in the tutorial. The remainder of this lesson gives an overview of the values available per category, along with short descriptions of each of the different kinds of values.
Elementary values
- Booleans
-
Represents truth values of for instance guards and other conditions. The only two possible values are
true
andfalse
. - Integers
-
Represent integer numbers, such as
-123
and5
. - Enumerations
-
Represent enumerated values, which are collections of names each representing a different value. For instance, a enumeration named
color
could have valuesred
,green
, andblue
. - Reals
-
Represent real numbers, such as
1.56
and-2.7e6
(scientific notation for 2.7 million). - Strings
-
Represent textual values, such as
"hello world"
and"some text"
.
Container values
- Tuples
-
Tuples have two or more ordered values, each of which can have a different type. For instance:
(1, true, 5.0)
. - Lists
-
Lists have zero or more ordered values, each of which has the same type, and possibly with duplicates. For instance:
[1, 5, 2, 1]
. - Sets
-
Sets have zero or more unordered values, each of which has the same type, and without any duplicates. For instance:
{1, 5, 2}
. - Dictionaries
-
Dictionaries have keys and associated values. The keys are unique and each map to a value. For instance:
{1: true, 2: false, 3: false}
.
Miscellaneous values
- Functions
-
Functions take values and use them to compute other values, possibly using complex and lengthy calculations.
- Distributions
-
Stochastic distributions allow for sampling, making it possible to produce random values.