Data Types
Euphoria has two basic data types:
- atom
- A number, implemented as a 31-bit signed integer or a 64-bit IEEE floating-point. Euphoria dynamically changes between integer and floating point representation according to the current value.
- sequence
- A vector (array) with zero or more elements. Each element may be an atom or another sequence. The number of elements in a sequence is not fixed (i.e. the size of the vector/array does not have to be declared). The program may add or remove elements as required during run-time. Memory allocation/deallocation is automatically handled by reference counting. Individual elements are referenced using an index value enclosed in square brackets. The first element in a sequence has an index of one . Elements inside embedded sequences are referenced by additional bracked index values, thus X refers to the second element contained in the sequence that is the third element of X. Each element of a sequence is an object type (see below).
Euphoria has two additional data types predefined:
- integer
- An atom, restricted to 31-bit signed integer values in the range -1073741824 to 1073741823 (-2^30 to 2^30-1). Integer data types are more efficient than the atom data types, but cannot contain the same range of values. Characters are stored as integers, e.g. coding ASCII-'A' is exactly the same as coding 65.
- object
- A generic datatype which may contain any of the above (i.e. atom, sequence or integer) and which may be changed to another type during run-time.
There is no character string data type. Strings are represented by a sequence of integer values. However, because literal strings are so commonly used in programming, Euphoria interprets double-quote enclosed characters as a sequence of integers. Thus
"ABC"
is seen as if the coder had written:
{'A', 'B', 'C'}
which is the same as:
{65,66,67}
Read more about this topic: Euphoria (programming Language)
Famous quotes containing the words data and/or types:
“This city is neither a jungle nor the moon.... In long shot: a cosmic smudge, a conglomerate of bleeding energies. Close up, it is a fairly legible printed circuit, a transistorized labyrinth of beastly tracks, a data bank for asthmatic voice-prints.”
—Susan Sontag (b. 1933)
“The bourgeoisie loves so-called positive types and novels with happy endings since they lull one into thinking that it is fine to simultaneously acquire capital and maintain ones innocence, to be a beast and still be happy.”
—Anton Pavlovich Chekhov (18601904)