AMT Datasouth PAL User Manual
Page 34
[...]
28
[...]
Description
Operator pair used to define an array object.
Usage
[
...
]
Array
Array
Array. Object defined by operator pair.
Comments
In other programming languages, the language would treat symbols like these as syntactical in
nature as opposed to executable. However, under PAL, the PAL interpreter executes these symbols
in the same manner as add or any other PAL operator.
The PAL interpreter executes the opening ("[") and closing ("]") symbols as completely inde-
pendent operators. The opening operator does nothing more than push a mark object onto the
operand stack. The closing operator instructs the PAL interpreter to build an array object from all
objects on the top of the operand stack down to, but not including, the top most mark object. After
PAL removes all the objects from the stack and places them into the new array, it discards the
mark object from the top of the stack.
Unlike many other programming languages, PAL arrays may contain mixed data types. These data
types can include dictionaries, other arrays, and other composite data types. The following
example creates an array containing four entries.
[(hello) [1 2 3] <> /LitName]
The example specifies the string (hello) as the first array entry, the three element array [1 2 3] as
the second entry, the two entry dictionary <> as the third entry,
and the literal name /LitName as the fourth entry.
Once the interpreter has created the array, it pushes the array object onto the top of the operand
stack.
Hints
PAL arrays can function in the same manner as random access data files. Using an array, a
programmer can create a file of data records directly within the PAL printer's memory. By creating
an array containing arrays, the programmer can recall an entire record of data simply by supplying
the index of the minor array record within the major array file. The minor array record can contain
all the data items for each record.