Fixed length list and variable length list

A fixed length list has a fixed number of elements, while the number of elements of a variable length list can decrease or increase. A list defined normally has a fixed length, while a list defined with a trailing tilde has variable length. For example,
x=(100, "Kernobe", ~);
Note that the length of list x is 2, and it is equal to the fixed length list y=(100, "kernobe"), except that x can be expanded or shrinked. The tilde at the end of the list is not a special element; it just signals that the list is capable of changing length. For example
x=(100, "Kernobe", ~);
x#3="Schwartz";
   (100, Kernobe, Schwartz)
x#5="Dark Helmet";
   (100, Kernobe, Schwartz, [], Dark Helmet)

If you plan to create a list x by starting with an empty list and adding new elements one by one, the list should be initialized as

x=(~);
Note that both (~) and () are empty list, but new elements can only be added to (~).

List plays a critical role in the operation of functions, as calling a function f with f(a,b,c) is equivalent to the multiplication operation between the function f and the list of arguments (a, b, c).

Variable length lists have the following attribute functions

For both fixed length and variable length lists

oz 2009-12-22