HyperFun: Types, Variables and Declarations
There are two fundamental types for variables ('real' and 'array') and an additional one ('string').'Real' is the only elementary numeric type that is floating-point type and is equivalent to a 'double' type in C. Note that one can use integer constants but they are treated as a subclass of the same floating-point type; there is no explicit Boolean type but in the relational operators the floating-point value '0.' is treated as 'false', and other values are treated as 'true'.
Examples:
6.5No declarations for floating-point variables are needed.
'array' <arrayName> '['<size>']' ';'
where 'size' is a constant representing a number of elements of the array. The array's elements are indexed from 1 to size. So one can access the i-th element as
<arrayName>[i]
Examples of declarations of arrays with names 'xx' and 'pz':
array xx[3], pz[8];
The first element of 'xx' will be xx[1], and the forth element of 'pz' will be pz[4].
There are two special arrays with reserved names:
So, expressions inside a program can contain the elements of these arrays (for example: x[2], a[1]). It is supposed that the actual values for both arrays' elements are given from outside the program. The declarations for these arrays must be given in the head of a program (see below).
This type has a limited usage only as a constant being substituted instead
of a corresponding function's argument. A string is represented as a sequence
of characters surrounded by double quotation marks. The most typical usage of
this type is to reference to a file name.
Example:
"teapot.dat"