[Next] [Up] [Previous]

The LIST Statement

A LIST statement can have the form

       LIST*22 (MUTABLE) V

which declares V as an entity containing any number of values of MUTABLE type and names of up to 22 characters for each of these values.


       . V=_L(X=25.3, Y='HELLO', Z=_A(2,17,6))

causes the information that the pseudovariable X is the real number 25.3, Y is the string HELLO, and Z is a 3-element array containing the integers 2, 17, and 6 to be stored in the list V.

Note that the statement

       . V=_L(X=N)+V

puts a pseudovariable named X in the list V having as its value the value of N at the time that that statement was executed; it does not create any link between the variable N and the list V.

It is possible to create such a link in a LIST; the function _MQ(variable) can be used: assigned to a MUTABLE variable, it causes that variable to become the same as its argument. Thus,

     . V=_L(A=_MQ(A))

causes the MUTABLE item within the list V given the name A to have the type of, and to occupy the storage of, the FALCON program's variable A. Since _MQ(...) always returns a frozen result, it is not necessary to execute

       FREEZE V('A')

However, it is not possible to create such a link if A were a mutable variable; instead, it is far preferable to use a VLIST where this is desired.

Note that LISTs are considered to be unordered.

A list element may be referred to using the pseudovariable name as a list index: thus, a list can be thought of as an array with subscripts of type STRING; however, it cannot be declared as such, as arrays may not have undefined elements, and occupy contiguous memory corresponding to their 'index space'.

If the pseudovariable A in the list L is an array, element 3 in that array can be referred to using the notation _L('A')(3).

[Next] [Up] [Previous]